Hi Andrea,
Funny (?). I had the same request:
https://github.com/qgis/QGIS-Documentation/pull/6488

Regards,
Harrissou

Le jeu. 11 févr. 2021 à 20:13, Andrea Giudiceandrea <[email protected]>
a écrit :

> Hi all,
> is it expected that QgsGeometry constGet() and constParts() in PyQGIS
> return
> modifiable objects?
>
> In the Python Console:
>
> >>> geom=QgsGeometry.fromWkt( 'Point(16 41)' )
> >>> geom_const=geom.constGet()
> >>>
> geom_const.transform(QgsCoordinateTransform(QgsCoordinateReferenceSystem("EPSG:4326"),
> >>> QgsCoordinateReferenceSystem("EPSG:25833"), QgsProject.instance()))
>
> >>> geom_const
> <QgsPoint: Point (584102.13444570498540998 4539238.58925933390855789)>
> >>> geom
> <QgsGeometry: Point (584102.13444570498540998 4539238.58925933390855789)>
>
>
> >>> geom=QgsGeometry.fromWkt( 'MultiPoint((16 41))' )
> >>> for part in geom.constParts():
>
>
> part.transform(QgsCoordinateTransform(QgsCoordinateReferenceSystem("EPSG:4326"),
> QgsCoordinateReferenceSystem("EPSG:25833"), QgsProject.instance()))
>
> >>> geom
> <QgsGeometry: MultiPoint ((584102.13444570498540998
> 4539238.58925933390855789))>
>
>
> Regards.
>
> Andrea Giudiceandrea
>
>
>
> --
> Sent from:
> http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
> _______________________________________________
> QGIS-Developer mailing list
> [email protected]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to