[mapserver-users] substitute DATA parameter via URL?

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Thu Sep 30 21:27:01 PDT 2010


Hi,

I believe that with your Mapserver version you can do it by having

DATA "the_geom from (SELECT the_geom, oid, %acar% as qf FROM geotable) as 
foo USING UNIQUE oid USING SRID=4326"

and then making the requests with an extra "acar" parameter
&acar=the_column_you_want

A live example
http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=1059&HEIGHT=687&LAYERS=sea,borders,POI_free_query&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-574187,6558020,1615375,7978444&SRS=EPSG:3067&STYLES=&tag=shop&value=convenience

Change the request to contain &value=supermarket or &value=hardware and you will see slightly different maps.
The DATA behind this is 
DATA "way from (select (way),osm_id,tags from osm_point where (tags @>'%tag%=>%value%')) as foo using unique osm_id using srid=3067"

I have never really understood how the DATAPATTERN should be used and I have not found any examples from the documents yet.

-Jukka Rahkonen-

Stefanie Weykam wrote:

[mapserver-users] substitute DATA parameter via URL?
 

>  Dear list members,

> I would like to change the following DATA parameter via URL

> DATA "the_geom from (SELECT the_geom, oid, acar as qf FROM geotable) as 
foo USING UNIQUE oid USING SRID=4326"

> ..where acar is the variable (a table field name) that should change on 
request.

> How would the DATAPATTERN look like?

> I have tried without success:
DATAPATTERN "^the_geom from (SELECT the_geom, oid, [a-z]{4} as qf FROM 
geotable) as foo USING UNIQUE oid USING SRID=4326"
..which throws a parsing error near (DATAPATTERN)

> And I suppose the corresponding extension to the base URL would look 
like this?
..&map.layer[myLayer].data="the_geom from (SELECT the_geom, oid, emci as 
qf FROM geotable) as foo USING UNIQUE oid USING SRID=4326"
..worked fine on MapServer 4.6 (before validation war requiered)


> I wonder if it was easier to retrieve the entire table and substitute 
the field name. But I have 6 classes with expressions like this:

> EXPRESSION ([qf]> 20 AND [qf]<= 40)

> ..which would make the URL-extension even longer. Anyway, I haven't 
figured out how to set up the corresponding validation string of the 
either the classitem or the logical expression or both.

> I'm (still) working with MapServer v. 5.2.1

> Any examples for DATAPATTERN would be highly appreciated.

> Best regards
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the MapServer-users mailing list