[mapserver-users] [SOLVED] Re: Run-time Substitution and Raster file problem

thomas bonfort thomas.bonfort at gmail.com
Sun Mar 18 05:57:36 EDT 2012


On Sun, Mar 18, 2012 at 00:04, teknocreator <teknocreator at gmail.com> wrote:
> Thomas,
>
> THANK YOU VERY MUCH!    I knew the validation was important and I ran into
> the situation with the points layer where I forgot to include the
> validation_pattern line.  But, I forgot what the error was when that
> appeared last.  Since I had the VALIDATION block this time (and I'm not as
> well versed as I should be on regex), I didn't think to test it for a
> possible problem.  It's interesting, though, that a parsing error for the
> '%' was tripped instead of a validation error.  That's where I got turned
> around in trying to solve this.

I suspect the parser does not like % in unquoted strings. That's why
it is always a good idea to quote all strings in a mapfile, even if
the parser accepts most unquoted strings.
The error you ran into is a bit misleading. MapServer prints an error
message in case a RTS value failed validation, but does not halt the
execution and instead keeps the original unsubstituted string. This
allows the default value to be substituted if it was configured, but
makes debugging the issue a bit harder as the actual validation error
is not returned to the user doing the query. You could open a trac
ticket requesting that a validation error should halt execution and
return the error message instead of silently continuing with no
substitutions at all.

regards,

thomas


>
> So I now have these lines in the mapfile:
>
> Data "%file%"
>
> VALIDATION
>  'file' '^.*$'  #have to look into changing this to something with a bit
> more checking
> END
>
> And in my OpenLayers code, just a quick test which first declares the raster
> layer for the first hour (1):
>
>     wmsmap = new OpenLayers.Layer.MapServer( "GRIB TEST",
> "/cgi-bin/mapserv",
>                {layers: "mosaic", SRS:"EPSG:3857",
> map:"wxmap/glmpvis2.map",
>                 format:'image/png', mode: "map", file: "dsvis1.grb",
>                 transparent:true, reaspect: "true"},
>                {singleTile: true, ratio: 1, isBaseLayer: false, opacity:
> 1.0, visibility: true,
>                 projection: new OpenLayers.Projection("EPSG:3857"), active:
> false});
>
> and then modifies the file name between dsvis1.grb and dsvis10.grb
>
> function updateMap(){
>
>    var Fhour=getFHour();  // another function getting hour from radio
> button group
>
>    var file = "dsvis" + Fhour + ".grb";
>
>    wmsmap.mergeNewParams({'file': file});
> }
>
> Radio buttons with the hours switch between the two and it works like a
> charm!
>
> Think I'll eventually add the default value lines too.
>
> Again, can't thank you enough!  Thanks to all who also commented!
> Hopefully, this helps someone else along the way.
>
> Dave M
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Run-time-Substitution-and-Raster-file-problem-tp4626749p4629087.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list