Friday, 20 October 2017

convert - Converting a .dxf to a .shp containing a field with height information in QGIS?


I received two .dxf for my project that represent my area of interest: one of them contains buildings, the other one terrain elevation (they both are 3D). I can successfully convert them to shapefiles using the Dxf2Shp plugin. They also display nicely compare to sample below:



sample of my model area


However, I loose the height information if I do so. The only field I get in the attribute table is "myid", that simply counts the polygons. Is there a way to convert the files to .shp creating a height field in the attribute tables, that takes the z values from the .dxf? This would already be fine, as the projection is metric.



Answer



You can try the GRASS command v.in.dxf in Processing or in the Grass plugin (look at GRASS GIS: import DXF).


enter image description here


Some results in GRASS GIS with 3D dxf files:



  • from Vector support in GRASS GIS: Möbius strip visualization to show the 3D vector capabilities of GRASS 6 - imported from 3D DXF (screenshot: M. Neteler)


enter image description here




enter image description here


The problem is that there is no support for 3D in QGIS: you must use Python with a module that support 3D (ogr or shapely), look at QGIS user: Using/visualizing 3D data (Z values) and QGIS user: visualizing 3D data (Z values) or data with z attribute: a solution or use the commands of GRASS GIS.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...