2

Is there a way to get Z value/height/altitude from 3D multipoint shapefile in QGIS? All I found is way through SpatiaLite or PostGIS as explained here:

http://faunaliagis.wordpress.com/2013/08/14/transfer-3d-shapefiles-z-values-to-the-table-of-attributes/

But conversion multipoint to point using Vector/Geometry tools/Multipart to singlepart drops the Z value. I opened DB manager, select DB and run SQL command in SQL window:

update tablename set columnname = st_z(st_pointn(geom,1)

In my case:

update lidar_pts set z= st_z(st_pointn(GEOMETRY,1))

First there was missing ")" at the end, second: no such column: geom. So I changed it to "GEOMETRY" which end up running but all z values become Null.

Is there a better/other way in QGIS 2? Or at least is there a way to convert multipoint to point directly in SpatiaLite so it will keep z geometry?

  • Also I have above 3M points in this file and have a lot of files... GDAL? – Miro Jul 30 '14 at 2:39
  • 1
    For the multipoint to point part, try ogr2ogr with parameters -nlt POINT25D -explodecollections gdal.org/ogr2ogr.html. – user30184 Jul 30 '14 at 4:52
  • @user30184 thank you, I can see there also -zfield field_name which could work for me, going to try that – Miro Jul 30 '14 at 6:12
  • The -zfield works the other way around - fill z geometry from column. So thanks to "-nlt POINT25D -explodecollections -lco SHPT=POINTZ" I am able to convert 3D multipoint to 3D point. But running that SQL returns null to z column. – Miro Jul 30 '14 at 23:21
2

From my understanding the current version of QGIS does not have 3D capabilities. You would have do, as you stated, 3D work in PostGIS or Spatialite. There may be a method to do the 3D functions you are inquiring about in Grass, which has a QGIS plugin.

  • 1
    Thank you, I decided to learn a bit more about GRASS and now I use GRASS GIS for all 3D processing - getting Z values from 3D / 2.5 D objects and saving to ascii x,y,z etc. – Miro May 21 '15 at 8:15
  • Glad you found a way, and it is working for you – Ryan Garnett Aug 6 '15 at 14:17
2

The upcoming QGIS 2.14 will have the necessary 3D-capabilities. I have tried it with 2.13 (Dev-version) and it works well: Article using z-values with QGIS 2.14

1

Please try to change the second part of the SQL-Statement: e.g. update lidar_pts set z= st_z(GEOMETRY) It worked fine for me with mulitpart-points - documented here http://isticktoit.net/?p=1117

  • Thank you, will try later. Meanwhile I decided to use GRASS to get Z value from 3D data. That is pretty helpful especially because I need here and there also import DXF files with 3D objects / meshes / lines / points. – Miro May 21 '15 at 8:18
  • In 2.13 (2.14) you also have to use GRASS for generating the 3D-FeatureClass (SHP) - but now you can work with the z-values within the table/field-calculator of QGIS. – Flo Xi Feb 29 '16 at 15:57
1

Try : How to create a 3D shapefile from a raster?

Use libraries as shapely or fiona (included in QGis python), extracted z value, you can add for example to attribute table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.