[mapserver-users] mapserver 6 beta5 and variable substitutions

adams adams at terrestris.de
Wed Apr 13 07:39:46 PDT 2011


Dear list,

I am just testing around with mapserver 6 beta5 and wonder, if there is 
an issue with the variable substitutuions.

Great work so far !! Thanks guys!

... and now my problem ;-):
We set a filter on events due to time and level in the client and send 
the parameters via url as variable substitutions to the DATA -request on 
postgis in the mapfile:


<mapfile snip>

CONNECTION 'user=....
DATA "geom from (select * from table WHERE level IN (%LEVEL%) AND (date 
BETWEEN '%TIME_START%' AND '%TIME_END%' OR ....))) as foo using unique 
id using SRID=..."
....

</mapfile snip>


Calling this via WMS getMap-Request:

http:// ... 
/mapserv6?map=maps.map&LAYERS=earthquake&...&LEVEL=1,2,3&TIME_START=2011-03-10&TIME_END=2011-03-24&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&....

Works fine for mapserver 5.6, but fails on mapserver6 (yes, I tried 
without variable substitution and all works fine after reading: 
http://mapserver.org/trunk/MIGRATION_GUIDE.html - thanks for that!)

This is the xml error I get:

<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
<!DOCTYPE ServiceExceptionReport SYSTEM 
"http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1">
<ServiceException>
msDrawMap(): Image handling error. Failed to draw layer named 
'earthquake'.
msPostGISLayerWhichShapes(): Query error. Error (ERROR:  syntax error at 
or near "%"
LINE 1: ...WHERE head_category_id = 34 AND level IN (%LEVE...
                                                             ^
) executing query: select 
"level",encode(ST_AsBinary(ST_Force_2D("head_geo"),'NDR'),'hex') 
as geom,"id" from (select * from app_head_event WHERE 
head_category_id = 34 AND level IN (%LEVEL%) AND (head_time_start::date 
BETWEEN '%TIME_START%' AND '%TIME_END%' OR 
head_time_end::date BETWEEN '%TIME_START%' AND 
'%TIME_END%' OR (head_time_end::date > '%TIME_END%' 
AND head_time_start::date < '%TIME_START%'))) as foo where 
head_geo && GeomFromText('POLYGON((11401706.0926982 
2783146.86697407,11401706.0926982 5613635.52927973,19986215.8245698 
5613635.52927973,19986215.8245698 2783146.86697407,11401706.0926982 
2783146.86697407))',900913)
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>
</ServiceExceptionReport>

It seems that the var-subs are not passed to the query... or is there 
something else I missed?

I just found one issue on variable substitutions:
http://osgeo-org.1803224.n2.nabble.com/MapServer-6-0-0-beta4-release-td6225613.html

But in my eyes this does not explain my problem.

Thanks in advance!

Till





More information about the MapServer-users mailing list