[mapserver-users] Problem with PHP MapScript $layer->nextShape()
Armin Burger
armin.burger at gmx.net
Fri Dec 9 15:17:11 PST 2011
Hi all
I tried to use with PHP MapScript the function for the LAYER class
"nextShape()" as described in the documentation with a small script
example.
The short version is
$extentMap = $map->extent;
$status = $layer->whichShapes($extentMap);
$shape = $layer->nextShape();
This works fine when layer and map are in the same projection. If the
projections of layer and map differ (e.g. EPSG 4326 for map and 3035 for
layer) then I get a segmentation fault. This happens for both MapServer
6.0.1 and 5.6.6, PHP version is 5.3, OS is Linux.
If before the call of whichShapes() I re-project the extent object
"$extentMap" to the projection of the layer then everything works fine.
So the following workaround seems to work:
$extentMap = $map->extent;
$mapProjObj = ms_newProjectionObj($map->getProjection());
$layerProjObj = ms_newProjectionObj($layer->getProjection());
$extentMap->project($mapProjObj, $layerProjObj);
$status = $layer->whichShapes($extentMap);
$shape = $layer->nextShape();
Best regards
Armin
More information about the MapServer-users
mailing list