Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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!

share|improve this question
    
Where are the elevations stored in your original file? Is it an attribute field? –  steko Dec 15 '12 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 Dec 15 '12 at 19:50
add comment

1 Answer

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:

<OGRVRTDataSource>
  <OGRVRTLayer name="test">
    <SrcDataSource>dave.csv</SrcDataSource>
    <GeometryType>wkbPoint</GeometryType>
    <LayerSRS>WGS84</LayerSRS>
    <GeometryField encoding="PointFromColumns" x="x" y="y", z="elev"/>
    <Field name="id" type="String"/>
    <Field name="description"/>
  </OGRVRTLayer>
</OGRVRTDataSource>

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.

share|improve this answer
    
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 Dec 17 '12 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 Dec 17 '12 at 19:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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