[mapserver-users] shape->draw problem

Alan Boudreault aboudreault at mapgears.com
Sun Jan 22 17:41:07 EST 2012


Hi Bob,

I do not see any query in your code. Not sure why numresults return a 
non-zero value. Check the example of the getShape() or nextShape() 
functions in the documentation:

http://mapserver.org/mapscript/php/index.html#layerobj

Alan

On 12-01-20 03:55 PM, Bistrais, Bob wrote:
> 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.
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


-- 
Alan Boudreault
http://www.mapgears.com/


More information about the mapserver-users mailing list