Hello,

I have two PostGIS layers: one with lines representing hiking paths, one 
with polygons representing administrative units, with the mapfile 
definitions in [1].

I am trying to elaborate a query in pmapper which would allow to select 
an admin unit in an options list and then in a second field select 
amongst the hikes that cross through that admin unit.

To start with, one general question: is it possible to create an options 
list dependent on the first options list (i.e. chose an admin unit in 
the first list and the get a second options list with only those hikes 
that cross that admin unit), or does the second field have to be a 
suggest field ?

Now, even using a suggest field in the second part, I just can't seem to 
get the correct config to make it work.

At [0] is the searchitem definition.

At this stage, I don't get any error message, but searches are empty, 
even though executing them directly in PostgreSQL works.

No error message in the postgresql, php or apache2 logs...

Any hints ?

Moritz


[0] Searchitem definition

         <searchitem name="balades_selon_communes" description="Choisir 
une balade selon une commune bruxelloise">
             <layer type="postgis" name="balades_avec_communes">
                 <field type="s" name="muniname1" description="Nom de la 
commune" wildcard="2">
                    <definition type="options" connectiontype="db" 
sort="asc" firstoption="Sélectionner une commune" nosubmit="1">
                      <dsn 
encoding="UTF-8">pgsql://USER:PASSWD@SERVER/DATABASE</dsn>
                      <sql>SELECT DISTINCT muniname1,muniname1 FROM 
communes ORDER BY muniname1</sql>
 
<events>onchange="resetSuggestCache();$('#pmsfld_name').val('')"</events>
                    </definition>
                 </field>

                 <field type="s" name="name" description="Nom de la 
balade"  wildcard="2">
                    <definition type="suggest" connectiontype="db" 
minlength="1" sort="asc" firstoption="Sélectionner une balade" 
dependfld="muniname1">
                      <dsn 
encoding="UTF-8">pgsql://USER:PASSWD@SERVER/DATABASE</dsn>
                      <sql>SELECT DISTINCT name,name FROM balades JOIN 
communes ON (ST_Crosses(ST_Transform(balades.the_geom, 31370), 
communes.the_geom)) WHERE name ~* E'^[search]' AND muniname1 = 
'[dependfldval]' ORDER BY name</sql>
                    </definition>
                 </field>
             </layer>
         </searchitem>




[1] Mapfile definitions

#admin units
LAYER
     NAME 'communes'
     TYPE POLYGON
     TEMPLATE void
     CONNECTIONTYPE postgis
     CONNECTION "dbname='MyDatabase' host=localhost port=5432 
user='MyUser' password='MyPassword' sslmode=disable"
     DATA 'the_geom FROM (SELECT gid, the_geom, muniname1 FROM communes) 
as subquery USING UNIQUE gid USING srid=31370'
     METADATA
        "DESCRIPTION" "communes"
        "RESULT_FIELDS" "gid,muniname1"
        "RESULT_HEADERS" "ID,Nom"
        "ows_title"      "communes"
        "LAYER_ENCODING" "UTF-8"
     END
     TRANSPARENCY 100
   PROJECTION
        "init=epsg:31370"
   END
     CLASS
        NAME 'communes'
        STYLE
          WIDTH 1
          OUTLINECOLOR 0 0 0
        END
     END
   END

#hikes
LAYER
     NAME "balades"
     TYPE LINE
     TEMPLATE void
     CONNECTIONTYPE postgis
     CONNECTION "dbname='MyDatabase' host=localhost port=5432 
user='MyUser' password='MyPassword' sslmode=disable"#Prendre simplement 
tous les champs de la table balades
     DATA "the_geom FROM (SELECT b.gid, b.the_geom, b.name, 
b.duree_minutes, b.longueur_metres, upper(a.prenom) || ' ' || 
upper(a.nom) as nom, a.email, a.section FROM balades b JOIN auteur a ON 
(b.id_auteur = a.id)) AS SUBQUERY USING UNIQUE gid USING srid=4326"

     METADATA
       "RESULT_FIELDS" "name,duree_minutes,longueur_metres,nom,section"
       "RESULT_HEADERS" "BALADE,DUREE (min),LONGUEUR (m),AUTEUR,SECTION"
       "DESCRIPTION" "Balades"
       "ows_title" "balades"
       "LAYER_ENCODING" "UTF-8"
     END #Metadata
   PROJECTION
     "init=epsg:4326"
   END #Projection
     CLASS
        NAME 'Balades'
        COLOR 255 0 0
     END #Class
END #Layer



------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
pmapper-users mailing list
pmapper-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to