I have contour lines with the elevations of them in an attribute called 'CONTOUR' however these do not actually elevate the lines when I bring them into AutoCAD. To do this I want to copy and paste the 'CONTOUR' attribute information and paste it into the 'ELEVATION' attribute as shown in the table. When I Join the excel sheet to the shapefile it doesn't bring in the elevations though and I am not sure why.

enter image description here

enter image description here

enter image description here


When exporting the contour lines you also can use the OSgeo4W Shell:

  • Navigate to your folder where your shapefile is located

  • use this comand:

    ogr2ogr -f DXF output.dxf input.shp -zfield CONTOUR
  • ignore the warnings you will get

  • the zfield argument adds the height information to you dxf file, which is created in the same folder as the input.shp
  • I use the command in the OSgeo4W shell as I am navigating to the folder in the QGIS browser? Not much experience with the shell. – Shub Jun 28 '17 at 12:18
  • @Jhunt9 lets say your countour,shp file sits in C:\myfolder\my_otherfolder. So you would navigate to this folder with cd C:\myfolder\my_otherfolder – LaughU Jun 28 '17 at 12:20
  • 1
    My shp file is in my temp folder. So exactly what do I type into my Shell? >cd C:\temp >>ogr2ogr -f DXF output.dxf input.shp -zfield CONTOUR – Shub Jun 28 '17 at 12:26
  • @Jhunt9 yeah if your shapefile is named "input" then it should work else it would be something like cd C:\temp and then ogr2ogr -f DXF output.dxf my_file_name.shp -zfield CONTOUR the CONTOUR is name of the attribute field where the height information is stored# – LaughU Jun 28 '17 at 12:31
  • 1
    @Jhunt9 - Do not type python, restart the OSGeo4W shell then type the command in. – Joseph Jun 28 '17 at 12:43

I got the results I wanted but only through the Query command in AutoCAD. Tutorial can be found here: https://knowledge.autodesk.com/support/autocad-civil-3d/learn-explore/caas/sfdcarticles/sfdcarticles/Importing-an-ESRI-shapefile-with-elevation-values-s.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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