I'm trying to convert points (with their elevations) into a dxf file for use in AutoCAD LT. I've tried "save as" to dxf for the layer, which appears to almost work...the dxf has x and y location information, but the elevations associated with the points are not present.

I also tried the "dxfauth" openware tool, but that did the same as the above. Thanks!

  • Where are the elevations stored in your original file? Is it an attribute field?
    – steko
    Commented Dec 15, 2012 at 19:06
  • Yes, it's an attribute field. I imported a csv file that contained the survey points with fields: id, x, y, elev, description.
    – Dave
    Commented Dec 15, 2012 at 19:50

1 Answer 1


QGIS does not manage Z coordinates importing CSV files.

You can convert the CSV to DXF using ogr2ogr from the command-line shell. This should be already installed since QGIS uses OGR too.

You need to create a .vrt file along your CSV. This is a plain-text file that you can create with any text editor. It is really easy in your case:

  <OGRVRTLayer name="test">
    <GeometryField encoding="PointFromColumns" x="x" y="y", z="elev"/>
    <Field name="id" type="String"/>
    <Field name="description"/>

Save this file in the same directory as the CSV file. If the CSV file is called dave.csv, it is practical to name it dave.vrt. Check on the third line that the SrcDataSource is correct, that is that the filename is the same as your CSV file. The LayerSRS can probably stay like this, as DXF has no concept of spatial reference system.

When the file is ready, from the command line you would issue:

ogr2ogr dave.dxf dave.vrt 

This procedure is not needed for other formats. See this question about the zfield option in ogr2ogr.

  • Thanks for the great information Steko! I did as you mentioned, and tried running as described from the windows command prompt (qgis bin directory, where ogr2ogr is located)...it did seem to run, but I got "Failure: unable to open datasource 'pondsur.dxf' with the following drivers..." Thoughts?
    – Dave
    Commented Dec 17, 2012 at 3:18
  • Of course it's not working. I got the order of arguments wrong :( - the destination data source has to be the first one. Fixed in the answer above.
    – steko
    Commented Dec 17, 2012 at 19:39

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.