You need to validate the substituted variable: LAYER VALIDATION "id_country" "^[0-9]+$" END DATA ... END
On Tue, Aug 21, 2012 at 4:41 PM, Stefan Schwarzer <stefan.schwar...@unep.org> wrote: > Thanks so much for the quick responses! > > If I understand it correctly, I need to specify "DATAPATTERN" in the MAP > part, in order to use the parameter in the DATA request: > > Doc is saying: LAYER: DATA (must validate against DATAPATTERN) > > > which would look like this: > > SHAPEPATH '/www/xxx/data' > FONTSET '/www/xxx/htdocs/mod_map/etc/fonts.txt' > SYMBOLSET '/www/xxx/htdocs/mod_map/etc/symbols.sym' > DATAPATTERN '^[0-9]' > > > with the DATA request like: > > DATA "the_geom FROM (SELECT xxx FROM capitals WHERE > capitals.id_country <> %id_country%) AS foo USING UNIQUE gid USING srid=4326" > > > Hmmm…. But that doesn't work. > > msDrawMap(): Image handling error. Failed to draw layer named > 'capitals_mask'. > msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR: > syntax error at or near ")" > LINE 1: ...capitals WHERE capitals.id_country <> %id_country%) AS foo w… > > > Can you shed some light on it? I am not really familiar with the regular > expressions. I am just passing an integer. > > Thanks for any hints! > > Stef > > > > > On Aug 21, 2012, at 4:10 PM, Till Adams wrote: > >> Stefan, >> >> from mapserver 6 on you must define the default values for the >> parameters in your metadata-tag and also provide a validation-pattern. >> >> You'll find more here: >> http://mapserver.org/cgi/runsub.html >> >> Regards, Till >> >> >> >> On 21.08.2012 16:07, Stefan Schwarzer wrote: >>> Hi there, >>> >>> I used to pass a parameter in a WMS request in order to specify which >>> country should be highlighted. The MAPFILE would read that and, via an >>> EXPRESSION, set all country but the selected one to a bit of opacity: >>> >>> DATA "the_geom FROM (SELECT xxx FROM capitals WHERE >>> capitals.id_country <> %id_country%) AS foo USING UNIQUE gid USING >>> srid=4326" >>> >>> That doesn't work anymore after upgrading our machine. So, I am not 100% >>> sure if this comes from mapserver, or if there is anything else involved. >>> But it seems more like a mapserver problem, as the error-message is >>> >>> <ServiceException> >>> msDrawMap(): Image handling error. Failed to draw layer named >>> 'capitals_selected'. >>> msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR: >>> syntax error at or near "%" >>> LINE 1: ...als.gid FROM capitals WHERE capitals.id_country = %id_countr... >>> ^ >>> >>> msValidateParameter(): Regular expression error. Parameter pattern >>> validation failed. >>> msValidateParameter(): Regular expression error. Parameter pattern >>> validation failed. >>> msValidateParameter(): Regular expression error. Parameter pattern >>> validation failed. >>> msValidateParameter(): Regular expression error. Parameter pattern >>> validation failed. >>> </ServiceException> >>> >>> >>> Thanks for any hints/clarification. >>> >>> Stefan >>> _______________________________________________ >>> mapserver-users mailing list >>> mapserver-users@lists.osgeo.org >>> http://lists.osgeo.org/mailman/listinfo/mapserver-users >>> >> >> -- >> >> NEWS: >> -> GO Mobile - jetzt WebGIS auch auf Smartphones >> -> Bald OpenSource! SHOGun - das JavaBackend für WebGIS Anwendungen >> >> >> ---------------------------------------------------- >> terrestris GmbH & Co. KG >> Puetzchens Chaussee 56 >> 53227 Bonn >> Germany >> >> Till Adams >> Geschaeftsfuehrung >> >> Tel: +49 (0)228 / 962 899-52 >> Mobile: +49 (0)151 / 25394429 >> Fax: +49 (0)228 / 962 899-57 >> >> ad...@terrestris.de >> http://www.terrestris.de >> Amtsgericht Bonn, HRA 6835 >> ---------------------------------------------------- >> >> Komplementaerin: >> >> terrestris Verwaltungs GmbH >> >> vertreten durch: >> Hinrich Paulsen, Till Adams >> _______________________________________________ >> mapserver-users mailing list >> mapserver-users@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/mapserver-users >> > > _______________________________________________ > mapserver-users mailing list > mapserver-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/mapserver-users _______________________________________________ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users