I have contours which I have brought into QGIS from a GEOjson - the lines have an attribute of 'altitude'. I want to export these contour lines as a DXF with the lines raised in the zplane according to their 'altitude'. I'm new to Qgis - have heard I can use the 'command line' (Is this the 'commander' under the processing tab?) which suggested org2org?? but I couldn't understand how to use this at all.

1 Answer 1


You can do it in two ways: either by having the elevation data stored within the geometry (as a Z-index), or externally in the attributes table.

If stored in the geometry, you can use QGIS' own convertion tool (which uses ogr2ogr? I'm not sure), by selecting your layer and 'Saving As...', then changing the export output from the custom ESRI Shapefile to AutoCAD DXF.

If your data is stored as a field in the table (as seems to be the case in your example), ogr2ogr would be the more appropriate. You can use the GDAL functions either in the command prompt (that would be your OS prompt, cmd in Windows and terminal in Mac/Linux) or in the OSGeo shell (which should have been installed with QGIS). Check the ogr2ogr documentation page below for more info on how to convert, but in a nutshell it'd look like this:

ogr2ogr -f DXF file.dxf file.shp -zfield elev

Given that your data is in Shapefile format and your elevation field is called elev.


  • Hi thanks Roberto, - so the command prompt is not within QGIS (this was a great source of confusion for me). The OSGeo shell I'm not sure about - I installed QGIS myself -but I will look into.Thanks again really helpful and clear.
    – N-particle
    Mar 27, 2015 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.