[Cartoweb-users] Tooltip plugin.

Oliver Christen oliver.christen at camptocamp.com
Mon Sep 15 03:06:35 EDT 2008


Hi

all you can do is recovering the sql query generated by the plugin and try 
it directly into your postgres. This will tell you if the problem comes from 
the query or from the data.
you can do that by replacing
        return sprintf('SELECT %s FROM %s ' .
                       "WHERE %s && setSRID('%s'::box3d, %s) ".
                       "AND Distance(%s, GeometryFromText( '".
                       "POINT(%s %s)', %d ) ) < %s",
                       $this->getReturnedAttributes(),
                       $this->dbTableName,
                       $this->dbGeomColumnName,
                       $bbox3D,
                       $this->srid,
                       $this->dbGeomColumnName,
                       $geoX,
                       $geoY,
                       $this->srid,
                       $toleranceGeo);

by

        $sql = sprintf('SELECT %s FROM %s ' .
                       "WHERE %s && setSRID('%s'::box3d, %s) ".
                       "AND Distance(%s, GeometryFromText( '".
                       "POINT(%s %s)', %d ) ) < %s",
                       $this->getReturnedAttributes(),
                       $this->dbTableName,
                       $this->dbGeomColumnName,
                       $bbox3D,
                       $this->srid,
                       $this->dbGeomColumnName,
                       $geoX,
                       $geoY,
                       $this->srid,
                       $toleranceGeo);


      print $sql;
      return $sql;
in file QueryableLayer.php

modifying the behaviour of the tooltips javascript is certainly possible but 
not easy, due to the complexity of Cartoweb javascript framework.
also, the tooltips tool do not have a "state" like zoom or pan or query, it 
is always on. If you wanted to have it react on click only, you would need 
to modify the tooltips php class and implement the toolprovider interface 
and define a specific tool for it which would then appear in the toolbar. so 
user would have to specificaly select that tool to by able to get info on 
clic, then switch back to another tool to continue navigating.

Regards
Oliver

> Hi!
>
> I try to use the tooltip plugin.
> I have created the "tooltips.ini.in" file in client_conf with the 
> following contents:
>
> timeout_async.bank_store.label="Bank Stores"
> timeout_async.bank_store.dsn=pgsql://postgres:<password>@localhost:5432/postgis
> timeout_async.bank_store.dbTableName=volos
> timeout_async.bank_store.attributes="city_lat"
>
> I also load the plugin in client.ini.in.
> After installation the plugin works.
> But i get the AJAX message that there was no result.
> I have transfered the data from the shapefile to the postgis database 
> using shp2pgsql.
> With that,i get the table which contains the data.
> The table contains the column named "the_geom".
> So i guess everything is fine with the data in PostGIS.
> Right?
>
> Also,is there any way that this plugin works only when i click a point of 
> a layer or i leave the mouse on it?
> Because,when i use it as it is, anywhere i leave the mouse on the map, 
> tooltip plugin searches for a point in the database.
>
>
>
> Any opinion on what i should do?
> Thank you.
>
>
>
>
>
>
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
> 



More information about the Cartoweb-users mailing list