[Cartoweb-users] LOCATE plugin example

Dirk Jesko ml.dje at geocontent.de
Thu Mar 22 05:20:01 EST 2007


Hi Christopanos,

if you just want to use the locate plugin, you need to activate AJAX, as 
well as the id_recenter and locate plugins. Further, the data must be in 
a database.
My suggestion is that you first get the id_recenter plugin working with 
the layers and columns you want to use in the locate plugin. Then set 
the DNS and queries accordingly in client_conf/locate.ini, e.g. like this:

dsn = pgsql://user:passwd@db_host:db_port/database

locate.0.id = kreise
locate.0.label = "Kreis"
locate.0.sql= "SELECT gid, kr_name FROM kreise WHERE kr_name ~* '%s' 
order by kr_name LIMIT 10"

locate.1.id = wzbra_identnr
locate.1.label = "Identnummer"
locate.1.sql= "SELECT gid, identnr FROM mitglieder WHERE identnr ~* 
'^%s' order by identnr LIMIT 10"
...

The first column in the select statement is the id (the same one that is 
used in id_recenter), the second one is the string displayed in the GUI. 
Of course, the user set in the dns needs select privileges on the 
required tables in the database.
You do not need to change the template, the standard version should 
work. However, you might need to load the locate.css and the template in 
cartoclient.tpl (if it is not already there), e.g.

  {if $locate_active|default:''}<link rel="stylesheet" type="text/css" 
href="{r type=css plugin=locate}locate.css{/r}" />{/if}
...
  {if $locate_active|default:''}{$locate_form}{/if}

After I did all this, it worked for me.

If it does not, I suggest that you take FireFox and FireBug. Latter 
allows you to see the communication between the client and the server, 
e.g. all the requests and responses the AJAX is handling.


Regards,
Dirk


> Hi everybody !
>  
>     I try to use the locate plugin in order to create a search tab 
> (onglet).
>  
>     Do you have an example of a project which use this plugin, the 
> template file and the locate.ini? I have ever tried to understand the 
> demoPlugins project but no success.
>  
> Thanks
>
> ------------------------------------------------------------------------
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos 
> questions ! Profitez des connaissances, des opinions et des 
> expériences des internautes sur Yahoo! Questions/Réponses 
> <http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com>.
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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