specific raster queries

Frank Warmerdam warmerdam at POBOX.COM
Thu Apr 6 12:14:06 EDT 2006

Erick Ferreira wrote:
> Hello,
> I would like to share our need in our current project. We have been
> thinking that maybe going for an effective implementation in MapScrip might
> be a gain for both MapServer and our product.
> We have been writing a service layer that is a dynamic library in C that
> exposes some raster utility functions. We would like to use only the
> exported mapscript symbols (from libmapscript.so).
> One of the functions we have to expose in our library is supposed to fetch
> the raster values of a given layer band that lie on a client-defined line
> segment described in map coordinates.
> Map Server 4.8.1 does not support a msRasterQueryByLine() method. Also,
> even the msRasterQueryByShape() function in fact queries the whole bounding
> box of the polygon, not the polygon itself. 


I think we discussed this in IRC before?  Forgive me if I've forgotten
some of the details we worked out then.

You write that "msRasterQueryByShape() function in fact queries the
whole bounding box of the polygon, not the polygon itself."  Looking at
the code it appears that a full resolution block the size of the
requested line will be loaded into RAM, and then every single pixel in
that region will be tested for being inside the polygon using

It seems like this would produce the right results (assuming polygon
input) but is still very ugly from a performance point of view.

My suggestion would be to do some specializations in the implementation
of msRasterQueryByShape() for line geometries at least.  So this would
involve some gory work in maprasterquery.c.  If you are interested in
pursuing this angle, I'd be happy to answer questions and commit changes
after some checking.

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

More information about the mapserver-dev mailing list