[mapserver-users] mapserver 6 beta5 and variable substitutions

adams adams at terrestris.de
Wed Apr 13 10:39:46 EDT 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 
&#39;earthquake&#39;.
msPostGISLayerWhichShapes(): Query error. Error (ERROR:  syntax error at 
or near &quot;%&quot;
LINE 1: ...WHERE head_category_id = 34 AND level IN (%LEVE...
                                                             ^
) executing query: select 
&quot;level&quot;,encode(ST_AsBinary(ST_Force_2D(&quot;head_geo&quot;),&#39;NDR&#39;),&#39;hex&#39;) 
as geom,&quot;id&quot; from (select * from app_head_event WHERE 
head_category_id = 34 AND level IN (%LEVEL%) AND (head_time_start::date 
BETWEEN &#39;%TIME_START%&#39; AND &#39;%TIME_END%&#39; OR 
head_time_end::date BETWEEN &#39;%TIME_START%&#39; AND 
&#39;%TIME_END%&#39; OR (head_time_end::date &gt; &#39;%TIME_END%&#39; 
AND head_time_start::date &lt; &#39;%TIME_START%&#39;))) as foo where 
head_geo &amp;&amp; GeomFromText(&#39;POLYGON((11401706.0926982 
2783146.86697407,11401706.0926982 5613635.52927973,19986215.8245698 
5613635.52927973,19986215.8245698 2783146.86697407,11401706.0926982 
2783146.86697407))&#39;,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