Discussion:
[QGIS-Developer] Confused by Point vs. PointZ and LineString v. LineStringZ
C Hamilton
2018-12-04 15:40:24 UTC
Permalink
I have been writing some code that maintains the Z dimension for vector
layers. When I create a layer from QGIS points whether it is a point or
line layer and I create the points with QgsPoint(x, y, altitude), I can do
this without using PointZ or LineStringZ layers and it maintains the Z axis.

What is the purpose of PointZ, LineStringZ, and PolygonZ? Is there a reason
I should be using them when Point, LineString, and Polygon seem to work the
same? Is there a reason I should not use the Z versions?

Thanks,

Calvin
Nyall Dawson
2018-12-05 23:19:06 UTC
Permalink
I have been writing some code that maintains the Z dimension for vector layers. When I create a layer from QGIS points whether it is a point or line layer and I create the points with QgsPoint(x, y, altitude), I can do this without using PointZ or LineStringZ layers and it maintains the Z axis.
What is the purpose of PointZ, LineStringZ, and PolygonZ? Is there a reason I should be using them when Point, LineString, and Polygon seem to work the same? Is there a reason I should not use the Z versions?
This depends. I gather you mean that you can freely create geometries
with z or m dimension, regardless of whether the layer itself has
these dimensions? If so, it depends on the underlying layer type. Some
are more fussy then others, but some, (eg memory layers) will happily
accept any dimensionality without complaining.

This *can* cause issues when later converting these layers to other
formats though, so it's always best to correctly define the
dimensionality of your layer upfront.

Nyall
Thanks,
Calvin
_______________________________________________
Qgis-user mailing list
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Loading...