Of course I missed the last line:

  $map = new mapObj("simple.map");
  $drawLayer = $map->getLayerByName('drawshape1');
  $newshp = new shapeObj(MS_SHAPE_POLYGON);
  $newshp = $newshp->fromWKT($curwkt);
  $drawLayer->addFeature($newshp);


-jeff



--
Jeff McKenna
GatewayGeo: MapServer Consulting and Training Services
co-founder of FOSS4G
http://gatewaygeo.com/





On 2021-02-06 12:06 p.m., Jeff McKenna wrote:
Hi Paul,

I have recently had to upgrade all of my PHP scripts for several client's applications, to SWIG MapScript, and your fromWKT() note is a common one in all of my scripts too.  Good news though: your/our scripts are easily updated for SWIG as follows:


   $map = new mapObj("simple.map");
   $drawLayer = $map->getLayerByName('drawshape1');
   $newshp = new shapeObj(MS_SHAPE_POLYGON);
   $newshp = $newshp->fromWKT($curwkt);

(the issue is that you must first declare the new shape object separately, and then next use that same variable to call & load the WKT)

You're correct that the upcoming release will drop the old native mapscript, so please definitely don't be afraid to jump into existing tickets (such as this one that lists a few missing SWIG functions https://github.com/MapServer/MapServer/issues/1822 ) so we can all work together on making the 8.0 release great.

Thanks for your feedback,

-jeff




_______________________________________________
mapserver-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to