8

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.

2
  • In my experience it could be real tricky to get elevation data out from CAD. My solution is to convert contours (or other data) to a DEM in CAD and then export it to a GeoTiff. See this question for tips on that process.
    – Martin
    Commented Dec 6, 2013 at 8:59
  • The problem with that would be, that I don have AutoCAD. I only have QGIS…
    – dom
    Commented Dec 6, 2013 at 9:01

2 Answers 2

4

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.

1
  • I was not totally successful by now, but I think the supposed method will work. I have to learn working with GRASS GIS now. I only used it as a plugin for QGIS in the past, but it seems to provide some functions qGIS can't offer. Thanks!
    – dom
    Commented Dec 9, 2013 at 16:30
0

Since 2.14 Qgis supports 3d features. After importing DXF you can add height field with field calculator using expression:

z($geometry)

or

geom_to_wkt($geometry)

to get Well-Known Text (WKT) representation of the geometry.

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.