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

teknocreator teknocreator at gmail.com
Sat Mar 17 16:04:03 PDT 2012


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.

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.



More information about the MapServer-users mailing list