I´m trying to make a 3D shapefile from a raster feature but not working. Tried already to run the command in OSGeo4W but nothing happen. I'm using the Qgis 1.8.0 Lisboa. The purpose is to get a final 3D dxf file! Can anyone help me?
[GIS] How to create a 3D shapefile from a raster
3dqgisshapefile
Best Answer
For the moment, the geometry system of QGIS does not handle z-values but z-coordinates can be read by parsing the binary format of the geometry (see Why is it not possible to extract the z value of a wkb geometry with PyQGIS while it is possible with ogr or Shapely ?) of which I take the example:
With a 3D point shapefile in the Python console of QGIS:
But using other Python modules like osgeo.ogr or Shapely, you can extract the z value from the binary format of the QGIS geometry:
So, for create a 3D shapefile in the Python console or in the Python shell you must use modules that are able to handle the z value like ogr, Fiona with Shapely or Pyshp (CreateElevationValues)
Example with Fiona:
Control:
As an example of extracting the z value from a DEM and the color value from a geological map, see "Python: Using vector and raster layer in a geological perspective without GIS software", Python: utilisation des couches vectorielles et matricielles dans une perspective géologique, sans logiciel SIG , in French but the Python scripts are universal...