[mapserver-users] Variable-substitution cause WMS GetFeatureInfo error
Steve Lime
Steve.Lime at dnr.state.mn.us
Wed Aug 26 08:46:00 PDT 2009
Hmmm... If a the URL overloading works with WMS getMap then it should work with
getFeatureInfo. Can you confirm the former?
Steve
>>> On 8/26/2009 at 10:07 AM, in message
<1251299258021-3515191.post at n2.nabble.com>, AlessioDL
<alessio.dilorenzo at gmail.com> wrote:
> 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>
More information about the MapServer-users
mailing list