[GIS] DXF (points and lines) in QGIS – Doesn’t import z coordinates

demdxfqgis

Trying to get to grips with QGIS, coming from a MapInfo and Civil3D background.

I have a DXF file with points (X,Y,Z) and lines. I want to open this in QGIS and use the interpolate plugin to create my DEM.

When I open the DXF I assign a coordinate system, however the Z attributes don't seem to come across and so the interpolate function fails.

I could be doing something wrong on a very basic level – any pointers on where to start?

Best Answer

First forget about QGIS when playing with 3D, QGIS is not really there yet. If extracting vertices is enough or the lines are isolines (contours - constant elevation) then it is possible to use approach with free tools as explained here:

Importing 3D DXF file into QGIS with z information as attribute value?

The problem is when the lines in DXF have actually vertices in different elevations. In that case GRASS skip these lines when running v.to.rast. I think the only way in that case is to densify vertices on these particular lines to some needed minimum distance and extract them as points - v.to.points (dmax = your wanted minimum resolution value).

So in this case the process in open source GRASS (comes together with QGIS OSGeo4W installation):

v.in.dxf - to import contours including z dimension

v.to.points (dmax=) - to have all as points - while making sure lines become enough (dmax) dense points

v.to.rast (use=z) - convert dense points to raster

r.surf.contour - to linearly interpolate the rest of the surface (DEM) between points (lines)

In this case it is also possible to use other r.surf.* or interpolate from points v.surf.* or use v.out.ascii to export points to ascii x|y|z format and use any other software for surface interpolation