[mapserver-users] shape->draw problem

Bistrais, Bob Bob.Bistrais at maine.gov
Fri Jan 20 15:55:18 EST 2012


I'm upgrading an application from Mapserver 5.6 to 6.0.1, PHP MapScript.
I'm having a problem with one section of code where it gives a
shape->draw command.  In MS 5.6, the Shape was derived from a getFeature
method, but in MS 6 this had to be changed to a getShape.  The next
command is to draw the shape.  This returns the following error:

 

Fatal error: Uncaught exception 'MapScriptException' in
C:\ms4w_303\apps\mgs\htdocs\drawMap_detail_spatial.php:101 Stack trace:
#0 C:\ms4w_303\apps\mgs\htdocs\drawMap_detail_spatial.php(101):
shapeObj->draw(Object(mapObj), Object(layerObj), Object(imageObj)) #1
{main} thrown in C:\ms4w_303\apps\mgs\htdocs\drawMap_detail_spatial.php
on line 101

 

Here is the code leading up to the error:

 

            $oLayer_shape = $oMap->getLayerByName("master");

            for ($i=0; $i<=($oLayer_master->getNumResults() - 1); $i++)
{

                        $oResult = $oLayer_master->getResult($i);

                        $oLayer_master->open();

//                      $oShape =
$oLayer_master->getFeature($oResult->shapeindex,-1);
-Old getFeature method-commented out and replaced on next line:

                        $oShape = $oLayer_master->getShape($oResult);

                        $oShape->draw($oMap,$oLayer_shape,$oImage);
-fails on this line

                        $oLayer_master->close();

            }

 

I do believe I'm retrieving a valid shape.  What's even more confusing,
I've had to replace the getFeature with getShape in other parts of the
application and it seems to work. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120120/517efa61/attachment.html


More information about the mapserver-users mailing list