[mapserver-users] Variable-substitution cause WMS GetFeatureInfo error

AlessioDL alessio.dilorenzo at gmail.com
Wed Aug 26 11:07:38 EDT 2009


Hi,

I'm creating an application based on UMN-Mapserver used as WMS server. The
application adds a filtered layer (stored in postgis) to the map, adding
only the features respondig to the filter value.

In my mapfile I have this:

LAYER
...
FILTER "year = %year%"
...
END

I get the value of %year% from OpenLayer and it works fine: the wms layer is
filtered as expected and added to the map.
A problem comes when I try to query the filtered layer with a getfeatureinfo
request.
I obtain a syntax error near the % character. It looks like the variable is
treated as something wrong... Infact, if I replace the variable with a
static value (for example FILTER "year=2008") the getfeatureinfo works fine.

Is there a way to obtain a working getfeatureinfo mantaining the variable
(%year%) in the FILTER?

Thank you in advance


The error is this
<ServiceExceptionReport version="1.1.0">
-
<ServiceException>

prepare_database(): Query error. Error declaring cursor: ERROR:  syntax
error at or near "%"
LINE 1: ...t from (SELECT * FROM areas)AS foo WHERE ((year = %YEAR%)) a...
                                                             ^

With query string: DECLARE mycursor BINARY CURSOR FOR SELECT
asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from (SELECT
* FROM areas)AS foo WHERE ((year = %YEAR%)) and (the_geom && setSRID(
'BOX3D(15.4467741267663 43.8503721970904,15.5786100642428
43.945370093883)'::BOX3D,4326) )

</ServiceException>
</ServiceExceptionReport>
-- 
View this message in context: http://n2.nabble.com/Variable-substitution-cause-WMS-GetFeatureInfo-error-tp3515191p3515191.html
Sent from the Mapserver - User mailing list archive at Nabble.com.


More information about the mapserver-users mailing list