using Mapserver for on-the-fly raster data?

Frank Warmerdam fwarmerdam at GMAIL.COM
Wed Jul 6 11:30:38 PDT 2005


On 7/6/05, Jeff de La Beaujardiere <jeff2005 at svs.gsfc.nasa.gov> wrote:
> Frank Warmerdam wrote:
> > If so, it might make sense to create a .vrt "raw file header" for each band
> > you want to advertise, and then build your map around these.
> 
> A hidden gem!! I had no idea this VRT capability was available. It
> should get mentioned in the How To for rasters.

Jeff, 

Well, the VRT capability isn't mapserver specific.  It can be hard to 
know how much GDAL information makes sense to re-iterate in the
MapServer docs.  We have a similar issue vector "vrts" on the OGR
side, but the requests were sufficiently common that a specific howto
was prepared. 
 
> VRT certainly looks like it would allow me to avoid pre-extracting data
> from my 6GB raw binary raster files with well-known positioning of each
> "band" in the dataset. I suppose the VRT file(s) are enumerated in
> Mapserver's map file as a LAYER DATA filename?

Correct. 

Note that there is a builtin limit on the number of layers.  You may
need to recompile with a higher limit if you will end up serving a
very large number of layers. 
 
> Unfortunately, I'm not sure it is possible to get the correct
> "colorizing" of each data value. In my case, the data values in the
> input file are arbitrary but must be mapped to a discrete set of colors.
> That is, all values in the range [V_i, V_i+1) are mapped to color and
> opacity RGBA_i.

As of 4.6 (actually it might have been in 4.4 too), MapServer supports
the ability to apply classification to non-8bit raster data.  This is discussed
in the raster howto at:

   http://ms.gis.umn.edu/docs/howto/raster_data

There are a few caveats about precision since internally it actually
uses a 16bit lookup table applied to a scaled value.

> At present, I have been using IDL (Interactive Data Language) to extract
> the data and render it according to the specified color table, which
> gives me full control of the portrayal (but requires pre-generating images).

On 7/6/05, Jeff de La Beaujardiere <jeff2005 at svs.gsfc.nasa.gov> wrote:
> Frank Warmerdam wrote:
> > Another approach would be to intercept the WMS requests with a
> > script that would take care of extracting desired products in advance
> > before turning control over mapserv to satisfy the request.
> 
> I was thinking about his approach over lunch. However, it seems that
> once I go down this path I might as well skip calling Mapserver at all
> and simply let my WMS CGI generate the requested image by calling IDL.
> Unless I'm missing something (which is quite possible), I don't see
> where Mapserver provides the ability to control the raster portrayal.

Well, then you need to implement the full WMS support.  I was just 
suggesting that your preprocessor would find the LAYERS info,
and use it to pull the required dataset out of the "big file" before 
processing the request.  This leaves MapServer doing all the 
subsetting, classification etc. 

However, if you were to start from the python WMS that Allan wrote
for his WMS cookbook you might well be able to implement a small
custom WMS service calling out to IDL to do some of the work.  
Of course, your custom WMS might have some limitations that 
MapServer doesn't (like reprojection, variety of output formats, etc). 

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the MapServer-users mailing list