Raster Analysis and MapServer

Frank Warmerdam warmerdam at POBOX.COM
Tue Dec 20 14:00:07 EST 2005


On 12/20/05, Ari Jolma <ari.jolma at tkk.fi> wrote:
> The way it works now is a bit, well, maybe more than a bit, hackish. In
> libral I have a C function to get a rectangle from GDAL (using
> GDALRasterIO) into a libral data, and that's all. It's one way street
> currently. In libral there's a function to write the data into a .bil file.
>
> Geo::Raster image (actually, an integer or real raster) is in the libral
> C struct and has to be accessed from Perl through the Perl/C interface.

Ari,

Python Numeric is similar in that the arrays are stored in memory
arrays with meta information in a C struct.  What I did to provide
GDAL access was write a special driver that uses a "filename" with
the pointer to the C struct encoded in the name.  Then the in
memory array can be treated as a GDAL dataset.

> How is a raster (or for that matter a vector) dataset handled in (Perl)
> mapscript? The Perl examples are a bit limited on mapserver website ;-)

The name of the raster dataset needs to be assigned to the "DATA"
item in the raster layer.  This is turned into a file handle internally
with a call to GDALOpen().  So to use a Geo::Raster  image
directly in MapServer you would pretty much have to build a GDAL
driver around it.  Alternatively, you could create a copy of the data
as an "in memory" file using the GDAL MEM driver.  The downside
of this is that yet another copy of the image is made, but for
common applications this might not be a problem.

> I'm probably getting more involved with using mapserver with a project
> we have -- or will have, the exact nature of it is still to be figured
> out. That should give me an opportunity to learn mapserver more and work
> out the link between it and libral.

Let me know if you pursue this, and I will help as I can.

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