Discussion:
[QGIS-Developer] Question About QgsGeometry Static Functions
C Hamilton
2018-12-04 16:51:49 UTC
Permalink
QgsGeometry has the following static functions

QgsGeometry.fromPolylineXY( list of QgsPointXY)
QgsGeometry.fromMultiPolylineXY( list of QgsPointXY lists)

If I am working with QgsPoint rather than QgsPointXY there is

QgsGeometry.fromPolyline( list of QgsPoint)

However there is not a similar multi polyline function. Why not?

QgsGeometry.fromMultiPolyline( list of QgsPoint list)

What is the proper way to implement this?

Thanks!!!!
Nyall Dawson
2018-12-05 23:06:32 UTC
Permalink
Post by C Hamilton
QgsGeometry has the following static functions
QgsGeometry.fromPolylineXY( list of QgsPointXY)
QgsGeometry.fromMultiPolylineXY( list of QgsPointXY lists)
If I am working with QgsPoint rather than QgsPointXY there is
QgsGeometry.fromPolyline( list of QgsPoint)
However there is not a similar multi polyline function. Why not?
Because there's been no demand for this, until now. But in general all
those fromPolylineXY etc methods should be avoided wherever possible.
They are very slow (lots of list allocations) and don't handle Z/M
dimensions.

You're better to work directly with the QGIS geometry subclasses like
QgsLineString, QgsMultiLineString instead.

Nyall
Post by C Hamilton
QgsGeometry.fromMultiPolyline( list of QgsPoint list)
What is the proper way to implement this?
Thanks!!!!
_______________________________________________
Qgis-user mailing list
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
C Hamilton
2018-12-06 15:02:59 UTC
Permalink
Thanks Nyall. I think I had a misunderstanding in that the XY routines were
the preferred method to use unless you have Z/M dimensions. I will look at
changing my code.

Calvin
Post by Nyall Dawson
Post by C Hamilton
QgsGeometry has the following static functions
QgsGeometry.fromPolylineXY( list of QgsPointXY)
QgsGeometry.fromMultiPolylineXY( list of QgsPointXY lists)
If I am working with QgsPoint rather than QgsPointXY there is
QgsGeometry.fromPolyline( list of QgsPoint)
However there is not a similar multi polyline function. Why not?
Because there's been no demand for this, until now. But in general all
those fromPolylineXY etc methods should be avoided wherever possible.
They are very slow (lots of list allocations) and don't handle Z/M
dimensions.
You're better to work directly with the QGIS geometry subclasses like
QgsLineString, QgsMultiLineString instead.
Nyall
Post by C Hamilton
QgsGeometry.fromMultiPolyline( list of QgsPoint list)
What is the proper way to implement this?
Thanks!!!!
_______________________________________________
Qgis-user mailing list
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Loading...