[MapServer-users] Python MapScript - GEOS

Seth G sethg at geographika.co.uk
Thu Nov 23 11:08:59 PST 2023


Hi,

Testing the code here and the following line: shpObjBuffer = shpObj.buffer( 0.0005 ) returns a valid buffered polygon:

>>> shpObjBuffer
<mapscript.shapeObj; proxy of <Swig Object of type 'shapeObj *' at 0x000002740979FEA0> >
>>> shpObjBuffer.toWKT()
'POLYGON ((49.9658578000000020 8.1601307999999992, 49

The buffer method [1] rerturns a new shape, so I'm not sure your check for a True value makes sense in this line:

>>>> if shpObjBuffer == mapscript.MS_SUCCESS:

Are you sure the buffer isn't working?

Seth

[1] https://mapserver.org/mapscript/mapscript-api/stub/mapscript.shapeObj.html#mapscript.shapeObj.buffer

--
web:https://geographika.net & https://mapserverstudio.net
twitter: @geographika

On Thu, Nov 23, 2023, at 7:16 PM, Nicol Hermann via MapServer-users wrote:
> Hello all,
>
> it there a way to verify that GEOS Support is properly working with
> Python mapscript.
> The below buffer method fails but the msGetVersion claims
> 'SUPPORTS=GEOS'. Anything else im overlooking?
>
>
> Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
> [GCC 10.2.1 20210110] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import mapscript
>>>> pktObj= mapscript.pointObj( 49.9653578, 8.1601308, 100 )
>>>> shpObj= pktObj.toShape()
>>>> shpObjBuffer= shpObj.buffer( 0.0005 )
>>>> if shpObjBuffer == mapscript.MS_SUCCESS:
> ...    rectObj = shpObjBuffer['bounds']
> ...    print( rectObj )
> ... else:
> ...    print('Error')
> ... 
> Error
>>>> print(mapscript.msGetVersion())
> MapServer version 8.0.1 PROJ version 7.2 GDAL version 3.2 OUTPUT=PNG
> OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE
> SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER
> SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER
> SUPPORTS=OGCAPI_SERVER SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR
> INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF
>
>
> Thanks for any help
>
> Nicol
>
>
>
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the MapServer-users mailing list