Re: [pmapper-users] Search XML with PostGIS
Brought to you by:
arminburger
From: Armin B. <arm...@gm...> - 2008-10-17 16:49:24
|
see my mail to Andreas. In your case in addition: make you life easier and put your join in a DB view and try using this view as DATA. armin On 17/10/2008 16:38, Marcello Benigno wrote: > Hi Andreas and Armin, > > I have te *same problem* too. why it happens? I have defined the XML as > follows: > > <searchitem name="acudes_grupo" description="Açudes"> > <layer type="postgis" name="acudes"> > <field type="s" name="ds_acude" description="Nome do Açude" > wildcard="0" /> > </layer> > </searchitem> > > and my layer: > > LAYER > NAME 'acudes1' > GROUP 'acudes_grupo' > > #======== POSTGIS ========# > CONNECTIONTYPE postgis > CONNECTION "dbname=<MYDB> user=<MYUSER> host=<MYHOST> password=<PASS>" > DATA "the_geom FROM > (SELECT a.cd_acude AS oid , a.ds_acude, a.nm_anoconclusao, > a.ds_riachobarrado, a.ds_tipobarragem, a.nm_capacidade, > a.nm_areabaciahidrografica, a.nm_baciahidraulica, a.nm_vazaoregularizada, > a.nm_extensaocoroamento, > a.nm_larguracoroamento, a.nm_cotacoroamento, a.nm_alturamaxima, > a.ds_tiposangradouro, > a.nm_largurasangradouro, a.nm_laminamaximasangradouro, a.nm_cotasoleira, > a.ds_tipotomadadagua, a.nm_diametrotomadadagua, a.nm_comprimentotomadadagua, > > a.ds_obs, cd_statusacude, a.fl_gerenciado, a.vl_valorestimado, a.the_geom AS > the_geom, > m.ds_municipio, b.ds_baciahidrografica > FROM acudes a, municipio m, baciahidrografica b > where a.cd_baciahidrografica = b.cd_baciahidrografica AND a.cd_municipio = > m.cd_municipio AND cd_statusacude=1) > as foo USING UNIQUE oid USING SRID=29184" > #======== END POSTGIS ========# > TYPE Point > TEMPLATE void > TOLERANCE 20 > TOLERANCEUNITS pixels > METADATA > "DESCRIPTION" "Açudes" > "RESULT_FIELDS" "ds_acude, ds_municipio, ds_baciahidrografica, > ds_riachobarrado, ds_tipobarragem, nm_capacidade, nm_areabaciahidrografica, > nm_vazaoregularizada, oid" > "RESULT_HEADERS" "Nome do Açude, Município, Bacia Hidrográfica, Rio Barrado, > Tipo de Barragem, Capacidade (m3), Bacia Hidrográfica (ha), Vazão (m3/s), > Detalhamento" > "RESULT_HYPERLINK" "oid||Clique aqui para mais informações" > END # Metadata > > LABELITEM 'ds_acude' > LABELMINSCALE 100 > LABELMAXSCALE 1600000 > > CLASS > NAME 'Construído' > LABEL > TYPE TRUETYPE > FONT FreeSans > POSITION UR > BUFFER 5 > SIZE 8 > COLOR 0 0 255 > OUTLINECOLOR 255 255 255 > ANTIALIAS TRUE > FORCE TRUE > END #LABEL > > STYLE > SYMBOL 'triangle' > SIZE 12 > COLOR 0 0 255 > OUTLINECOLOR 0 0 0 > END #STYLE > END #CLASS > END #LAYER > #--------------------------------------------------------------------- > > 2008/10/17 Andreas Haux <and...@sc...> > >> Armin, >> >> thanks for your feedback - and sorry for coming back with this issue. >> >> I have defined the XML as follows: >> >> <?xml version='1.0'?> >> <!-- <?xml-stylesheet href="style.xsl" type="text/xsl" ?> --> >> >> <searchlist version="1.0"> >> >> <dataroot>$</dataroot> >> >> <searchitem name="pfarreien" description="Pfarrei"> >> <layer type="postgis" name="pfarreien"> >> <field type="s" name="pfarrei" description="Name" >> wildcard="1" /> >> </layer> >> </searchitem> >> >> </searchlist> >> >> >> - The layer name in the .map-file is "pfarreien" >> - The database connection is defined in the map file >> - The database is "world", the table is "bamberg_pfarreien"; but this >> seems not to be neccessary here? >> - The column of the table where the search shall took place is "pfarrei" >> >> Everytime I start a search I only see the "working" image in the top >> right corner and nothing happens. >> >> After hours of testing - could you please have a look whether >> something is wrong with the xml? Thanks!! >> >> Regards >> Andreas >> -------------------------------------------------------------- >> screen & paper Werbeagentur GmbH >> Firmensitz: Martin-Luther-Straße 6, D-85354 Freising >> Telefon: +49-(0)8161-97 94-0 >> Telefax: +49-(0)8161-97 94-23 >> Registergericht: Freising, HRB 104 687 >> Geschäftsführer: Andreas Haux >> http://www.screen-paper.de >> http://www.csite.de >> http://www.maps-on-demand.com >> http://www.mapshop-online.de >> -------------------------------------------------------------- >> >> Disclaimer >> >> Der Inhalt dieser E- Mail ist ausschließlich für den bezeichneten >> Adressaten bestimmt und enthält vertrauliche und/oder rechtlich >> geschützte Informationen. Wenn diese E- Mail nicht an Sie persönlich >> adressiert ist oder Sie die Vertretung sein sollten, so beachten Sie, >> dass jede Form der Kenntnisnahme, Veröffentlichung, Vervielfältigung >> oder die Weitergabe des Inhalts dieser E- Mail unzulässig ist. >> >> This e-mail may contain confidential and/or privileged information. If >> you are not the intended recipient (or have received this e-mail in >> error) please notify the sender immediately and destroy this e-mail. >> Any unauthorised copying, disclosure or distribution of the material >> in this e-mail is strictly forbidden. >> >> >> >> Am 17.10.2008 um 12:50 schrieb Armin Burger: >> >>> Andreas >>> >>> have a look here >>> >>> http://svn.pmapper.net/trac/browser/pmapper/trunk/config/dev/ >>> search.xml >>> >>> If you do not need things like options/suggest then the definition >>> should be quite straightforward: >>> >>> <searchitem name="cities_pg" description="City PG"> >>> <layer type="postgis" name="cities10000eu_pg"> >>> <field type="s" name="name" description="City" wildcard="1" /> >>> </layer> >>> </searchitem> >>> >>> For options/suggest username/passwd need to be defined in the dsn like >>> >>> <dsn encoding="UTF-8">pgsql://username:passwd@localhost/gisdb</dsn> >>> >>> >>> armin >>> >>> >>> On Fri, Oct 17, 2008 at 9:23 AM, Andreas Haux >>> <and...@sc...> wrote: >>>> Hi, >>>> >>>> p.mapper is great - and I am experimenting for quite a while but >>>> didn't found out how exactly to define a search funktion in the >>>> search.xml file using PostGIS; the examples show the connection >>>> without sending a username and password. >>>> >>>> e.g.: >>>> Database name ist testdb >>>> Tablename is testfile >>>> Username is testperson >>>> Password is testpassword >>>> >>>> and I would like to select all the geometries where the field NAME is >>>> <searchstring> >>>> >>>> Here is your example where I have tried to fill this informations in, >>>> but I failed - I would simply like to establish a connection but did >>>> not know how to handle username and password (since the XML file is >>>> open to the public I could/would not include it here): >>>> >>>> <searchitem name="testsearch" description="Only a test"> >>>> <layer type="postgis" name="testfile"> >>>> <field type="s" name="name" description="City" >>>> wildcard="2"> >>>> <definition type="suggest" connectiontype="db" >>>> sort="asc" minlength="1" dependfld="cmcncd"> >>>> <dsn encoding="UTF-8">pgsql:// >>>> postgres:postgres@localhost/testdb</dsn> >>>> <sql>SELECT DISTINCT name FROM testtfile WHERE >>>> name ~* '^[search]' ORDER BY name</sql> >>>> </definition> >>>> </field> >>>> </layer> >>>> </searchitem> >>>> >>>> As far as I understand I don't need the suggest type in my case >>>> instead of receiving the results immediately at the map. So the most >>>> simple example how to write a request with PostGIS would be >>>> appreciated! >>>> >>>> Thanks for your help! >>>> >>>> Regards >>>> Andreas >>>> >>>> >> ------------------------------------------------------------------------- >>>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>>> challenge >>>> Build the coolest Linux based applications with Moblin SDK & win >>>> great prizes >>>> Grand prize is a trip for two to an Open Source event anywhere in >>>> the world >>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>>> _______________________________________________ >>>> pmapper-users mailing list >>>> pma...@li... >>>> https://lists.sourceforge.net/lists/listinfo/pmapper-users >>>> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> pmapper-users mailing list >> pma...@li... >> https://lists.sourceforge.net/lists/listinfo/pmapper-users >> > > > |