[QGIS-Developer] [Qgis-user] Confused by Point vs. PointZ and LineString v. LineStringZ

Nyall Dawson nyall.dawson at gmail.com
Wed Dec 5 15:19:06 PST 2018


On Wed, 5 Dec 2018 at 01:40, C Hamilton <adenaculture at gmail.com> wrote:
>
> 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
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


More information about the QGIS-Developer mailing list