[Qgis-developer] [Qgis-user] Using/visualizing 3D data (Z values)

Etienne Tourigny etourigny.dev at gmail.com
Wed Sep 26 06:21:41 PDT 2012


On Wed, Sep 26, 2012 at 9:24 AM, gene <martin.laloux at gmail.com> wrote:
> The problem is that Shapely is based on GEOS and GEOS isn't a 3D library at
> all. *The z of the geometries are not considered during any spatial
> operations but you can use matplotlib to represent the 3D geometry*
>

QGis is also based on GEOS.

I'm not talking about doing 3d operations, just having z level
available.  Currently it is read and copied internally (as I
experienced by exporting wkb to shapely), but not output to wkt and
others.  QgsPoint does not contain z value, but we could add a z() and
has_z() members like in shapely.  Enabling full 3d support is another
ball game entirely.

>>>> from shapely.geometry import Point
>>>> p = geometry.Point(1,2,3)
>>>> list(p.coords)
> [(1.0, 2.0, 3.0)]
>>>> p.has_z
> True
>>>> p.z
> 3.
>
> *and wkt et wkb formats do not recognize the z value*
>>>> p.wkt
> 'POINT (1.0000000000000000 2.0000000000000000)'
>

You are right, strictly speaking 3d points should be represented with
wkt POINTZ(x,y,z).

But perhaps we can be practical and allow for a simple extension?  We
could expose the z-level in the api, and *perhaps* expose it to the
wkt (since it's already exposed in the wkb).

This seems to be what is done in ogr (as it reports geometries with z values).

$ ogrinfo  2012-09-23\ 1359__20120923_1359.kml  Tracks
Had to open data source read-only.
INFO: Open of `2012-09-23 1359__20120923_1359.kml'
      using driver `KML' successful.

Layer name: Tracks
Geometry: 3D Multi Line String
Feature Count: 1
Extent: (-45.900415, -23.194376) - (-45.741626, -23.085176)
Layer SRS WKT:
[...]
Name: String (0.0)
Description: String (0.0)
OGRFeature(Tracks):0
  Name (String) = Segment 1
  Description (String) =
MULTILINESTRING ((-45.7416262 -23.08517574 561.3199,-45.74180873
-23.08526774 560.202, [...] ))


> *The geo_interface format (GeoJson), yes*
>>>> from shapely.geometry import mapping, shape
>>>> p.__geo_interface__
> {'type': 'Point', 'coordinates': (1.0, 2.0, 3.0)}
>
>
>
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-Qgis-user-Using-visualizing-3D-data-Z-values-tp5004272p5004608.html
> Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list