[mapserver-users] mapserver 6 beta5 and variable substitutions

Lime, Steve D (DNR) steve.lime at state.mn.us
Wed Apr 13 11:34:38 EDT 2011


The web metadata checking had a bug, I've fixed for the next beta.

Anyway, ideally I'd like abandon the metadata approach and stick these in the VALIDATION block. That's supported in 6.0, at least for the validation patterns. The defaults still live in layer metadata. 6.0 looks for patterns like so:

  1) layer validation block (e.g. 'level' 'pattern')
  2) layer metadata (e.g 'level_validation_pattern' 'pattern')
  3) web metadata (e.g. 'level_validation_pattern' 'pattern')

I suppose 1a) should be the web validation block shouldn't it, I just added that for beta 5. One thing to note is that you should avoid MapServer keywords for runtime tag names.

Steve

-----Original Message-----
From: adams [mailto:adams at terrestris.de] 
Sent: Wednesday, April 13, 2011 10:09 AM
To: Lime, Steve D (DNR)
Cc: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] mapserver 6 beta5 and variable substitutions

Steve,

:-[    oh,

sorry, it seems that my eyes have become bad ...

OK, I tried this:

    'LEVEL_validation_pattern' '1|1,2|1,2,3|1,2,3,4|1,2,3,4,5'
    'TIME_START_validation_pattern' '20$|^20'
    'TIME_END_validation_pattern' '20$|^20'
    'default_LEVEL' '1,2,3,4,5'
    'default_TIME_START' '2011-04-01'
    'default_TIME_END' '2011-04-30'

In the Maps web-metadata and/or layer-metadata tags, it works fine in 
the layer-metadata but not for the maps metadata.
If I understood your discussion on ticket #3522, there were plans to 
enable to put this into the maps-metadata tag as well?

Thanks so far!

Regards, Till




Lime, Steve D (DNR) wrote:
> Hi Till: From the migration guide...
>
> "Runtime subsitution now *requires* a validation pattern be present before the
> substitution will take place (this had been optional). This can be done via
> a layer metadata tag as before or within layer or web VALIDATION blocks. See
> ticket #3522 for more information."
>
> Could this be it?
>
> Steve
>
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of adams
> Sent: Wednesday, April 13, 2011 9:40 AM
> To: mapserver-users at lists.osgeo.org
> Subject: [mapserver-users] mapserver 6 beta5 and variable substitutions
>
> 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
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>   

-- 
 
---------------------------------------------------------
terrestris GmbH & Co. KG
Irmintrudisstrasse 17
53111 Bonn
Germany

Till Adams
Geschäftsführung

Tel: +49 (0)228 / 962 899-52
Fax: +49 (0)228 / 962 899-57
adams at terrestris.de http://www.terrestris.de
Amtsgericht Bonn, HRA 6835
---------------------------------------------------------

Komplementärin:

terrestris Verwaltungs GmbH

vertreten durch:
Hinrich Paulsen, Till Adams





More information about the mapserver-users mailing list