I've been using GIS softwares in the past few years by I'm new using AutoCAD.

Well, I have contour lines in AutoCAD and I want to export it into QGIS (I also have access to ArcMAP).

I saved as .dxf (AutoCAD 2007/LT 2007 DXF) in AutoCAD. It opened fine in QGIS. However, it seems that didn't export the contour values (Take a look in the attribute table).

Am I missing some step?

Atribute Table

  • i'm not sure what might cause the problem, but the other way round (GIS to CAD) it has to do with the labelling of the column where you put the height values. i always name my column "elevation", this usually helps. don't know if it's the same from CAD to GIS...
    – dru87
    Commented Jun 22, 2016 at 13:58
  • Output is polylineZ. In arcgis you can add Z information to table
    – FelixIP
    Commented Jun 22, 2016 at 19:37

3 Answers 3


If it is 3D DXF, follow the steps:

  1. import the dxf in QGIS (DRAG & DROP or CTRL + V);
  2. save as vectors (as the right mouse button);
  3. add new field Z (integer);
  4. Browser Panel to create a new database spatialite;
  5. DBManager to import the shape in the newly created database;
  6. run the update query;

step 1 picture 1

step 2 picure 2 picture 3

step 3 - add new field Z picture 4

step 5 -DB Manager picture 5

picture 6

picture 7

step 6 - query picture 8

picture 9

picture 10

  • I really liked your explanation and the richness of details. I would recommend you to add a shorter way of extracting the Z values shown by @Pierma: " Setup the new column (name and type) and use the expression: z(point_n($geometry, 1)) "
    – Matt_Geo
    Commented Jun 23, 2016 at 2:53
  • for a viable solution for QGIS 2.x (not only QGIS 2:14 onwards), I advise you to import the dxf in db spatialite; Then, extract the Z attribute
    – pigreco
    Commented Jun 23, 2016 at 8:44

@pigreco's answer should work.

But here a simpler solution without the spatialite process (step 1 to 2 are the same).

  1. Load your .dxf and export (save as...) as shapefile (or spatialite / postgis).

  2. On the new layer, use the Field Calculator (accessible from the main toolbar or from the attribute table).

    enter image description here

  3. Setup the new column (name and type, virtual or not depending on your needs) and use the expression :

    z(point_n($geometry, 1))

enter image description here

As @pigreco said, your dxf needs to be 3D.


I was having a similar issue. From CAD I extracted major and minor contours (command: _AeccSurfaceExtractObjects). From there, select all the 3Dpolylines generated from the extraction, and export to shapefile format (command: mapexport). In the export dialog box, select "Line" for object type, and "Select Manually". To get the Z-values, select the "Data" tab in the dialog box, and hit the "Select Attributes" button. From there, select the object property which contains the Z-values. This shapefile can then be directly imported to QGIS as a vector layer.

Hope this helps someone!

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.