Hi
I just had the same "problem" with python mapscript (python 2.5.2) on
mapserver 5.4.2 as my post from 2 years ago
can someone tell me what the return code "2" means for whichShapes ?
I looked at Mapserver and Mapscript source code (I dont know C so I just
followed the logical calls)
whichShapes calls for msLayerWhichShapes or return MS_FAILURE
*msLayerWhichShapes calls for msInitializeVirtualTable and LayerWhichShapes
**msInitializeVirtualTable calls for destroyVirtualTable,
createVirtualTable, and (in my case) msShapeFileLayerInitializeVirtualTable
or returns MS_FAILURE
***destroyVirtualTable returns MS_SUCCESS
***createVirtualTable calls for populateVirtualTable or returns MS_FAILURE
****populateVirtualTable return only MS_SUCCESS
***msShapeFileLayerInitializeVirtualTable return only MS_SUCCESS
**LayerWhichShapes is msShapeFileLayerWhichShapes in my case
***msShapeFileLayerWhichShapes calls for msShapefileWhichShapes or returns
MS_FAILURE
****msShapefileWhichShapes returns MS_DONE, MS_FAILURE or MS_SUCCESS
if I do :
print mapscript.MS_DONE
I get 2 so here is my culprit
so,
1) the documentation in incomplet, mapscript whichshapes can return
MS_SUCCESS, MS_FAILURE or MS_DONE
2) what the hell is MS_DONE ?
the code is in mapshape.c in function msShapefileWhichShapes :
/* rect and shapefile DON'T overlap... */
if(msRectOverlap(&shpfile->bounds, &rect) != MS_TRUE)
return(MS_DONE);
does that means the requested rect is completly outside of the shapefile
bbox ?
anyone can confirm that ?
thanks in advance
Oliver
----- Original Message -----
From: "Oliver Christen" <[email protected]>
To: <[email protected]>
Sent: Tuesday, September 09, 2008 8:36 AM
Subject: [mapserver-users] Re: phpmapscript whichShapes return code ?
Hi
using mapserver 5.0.2/php 5.2.5
im doing something like this:
$map = ms_newmapobj("d:/msapps/gmap-ms40/htdocs/gmap75.map");
$layer = $map->getLayerByName('road');
$status = $layer->open();
$status = $layer->whichShapes($map->extent);
while ($shape = $layer->nextShape())
{
echo $shape->index ."<br>\n";
}
$layer->close();
when checking the $status value of the $layer->whichShapes($map->extent);
instructions I get the values 0 or 2.
0 seems to be equal to MS_SUCCESS
but 2 is definitively not equal to MS_FAILURE
I did that:
if ($status === MS_SUCCESS) {
print "success"; // 0
} else if ($status === MS_FAILURE) {
print "failure"; // 1?
} else {
print "unknown"; // 2
}
I never get "failure", I only get "success" or "unknown"
so, what is the meaning of a code 2 value?
thanks in advance
Oliver
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users