php/mapscript queryByRect on raster files

Frank Warmerdam warmerdam at POBOX.COM
Mon Feb 13 08:39:32 PST 2006


Andrea Marelli wrote:
> Any hint?
> i will hopefully wait...
> Thanks!!
...
>> i'm implementing queryByRect on raster files using php/mapscript.
>> The script i've written (see following code) works well, but i have a little
>> problem when i make queries on large areas...
>> It seems that the getShape function uses a very large amount of memory on
>> the server, so i put $shape->free(); but it seems to do nothing..
>> Any suggestion on how to free shared memory on server?

Andrea,

If you make queries on large areas, a substantial chunk of memory is
allocated at the point of the query to hold all the results.  The maximum
number of values allowed in a query can be set with the PROCESSING option
RASTER_QUERY_MAX_RESULT on the layer.

eg.
   PROCESSING "RASTER_QUERY_MAX_RESULT=10000"

The default maximum is one million and I think there are 36 bytes of memory
allocated per row in the resultset so up to about 36MB.  Not such a huge
amount as a maximum.

I don't know the details of the proper way of freeing shapes, but it
seems what you are doing is appropriate.

I did a little test, and I don't see any obvious memory leaks in the core
mapserver raster query support.

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