3

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?

4
  • Also I have above 3M points in this file and have a lot of files... GDAL?
    – Miro
    Commented Jul 30, 2014 at 2:39
  • 1
    For the multipoint to point part, try ogr2ogr with parameters -nlt POINT25D -explodecollections gdal.org/ogr2ogr.html.
    – user30184
    Commented Jul 30, 2014 at 4:52
  • @user30184 thank you, I can see there also -zfield field_name which could work for me, going to try that
    – Miro
    Commented Jul 30, 2014 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
    Commented Jul 30, 2014 at 23:21

4 Answers 4

3

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.

2
  • 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
    Commented May 21, 2015 at 8:15
  • Glad you found a way, and it is working for you Commented Aug 6, 2015 at 14:17
3

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

2
  • 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
    Commented May 21, 2015 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
    Commented Feb 29, 2016 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.

2
  • Could you please explain how a solution with raster input would apply to a question about a shapefile input?
    – whuber
    Commented Aug 6, 2015 at 12:41
  • gis.stackexchange.com/a/57138/28647 - In this answer is your problem.
    – Marcel GJS
    Commented Aug 10, 2015 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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