[mapserver-users] Raster merge

Frank Warmerdam warmerdam at pobox.com
Tue Jul 1 08:45:55 EDT 2008


Andrew Mason wrote:
> Hello List,
> 
> I wonder if anyone can anyone suggest a possible mechanism for achieving 
> the following?
> 
> I have two rasters covering the same area.
> 
> Raster A contains the suitability of the location for the growth of 
> Species A (on a scale of 1 to 30)
> Raster B contains the suitability of the location for the growth of 
> Species B (on a scale of 1 to 30)
> 
> I would like to generate a layer that shows the result of the following 
> rule:
> 
> Display green at locations where Species A suitability is > 18
> Otherwise if Species B suitability > 14 display blue
> Otherwise display red.

Andrew,

I haven't tried this, but I think you could handle this with two layers
in your mapfile, one for each raster.  The first layer should be for RasterB.
It should have one class with an expression selecting suitability values
greater than 14 and a color of blue.  The next layer should be for RasterA
and have one class for suitabilities greater than 18 and a color of green.
It should also have a second class with no expression and a color of red.

There are some docs on raster classification in:

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

However, if RasterA and RasterB are not dynamic, you might consider
producing the merged result as a preprocessing step instead of making
MapServer do the computations for each map render.  It would be more
efficient.  Such raster modelling could be done in GRASS, for instance.

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    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list