3D DXF from MapInfo Tab or ESRI Shape (or anything) using OGR

Note:The following post requires gdal 1.8

A lot of times we need to send/use 3D dxf files, we used to use FME however FME is not free or cheap. So I went looking for a free solution.

If you have gdal 1.8 it’s just one simple command line run using, what is becoming my favorite GIS tool, ogr2ogr.

All you have to do is run:

ogr2ogr -f "DXF" {outFile} {inFile} -zfield {ColumnWithZValue}

So in my case I ran:

ogr2ogr -f "DXF" C:\Temp\contourswarwick.dxf C:\Temp\Contours.TAB -zfield Height

I haven’t fully tested it but {outfile} can be any file ogr supports.

and the output:

Top view of contours
Top view of contour layer
Contours side view
The side view of the above image.

In the words of, the not so great, Charlie Sheen. WINNING!

Happy mapping :D

4 thoughts on “3D DXF from MapInfo Tab or ESRI Shape (or anything) using OGR

  1. Hi Nathan,
    I would like to know more about this. Where to get, how to install it and how to use it. Please kindly help me because there some urgent work that I need to submit. Thanks….

    1. Hi Naz,

      You can install GDAL 1.8 using the installer from here: http://download.osgeo.org/osgeo4w/osgeo4w-setup.exe

      Run the exe and click express install, select GDAL and click next, follow the rest of the screens until it is installed.

      Once installed you should find a menu item in your start menu called “OSGeo4W”, open that and the sub menu “OSGeo4W” and click “OSGeo4W Shell”. You should then be able to run the command I posted.

  2. Speaking of 2.5/3D, I believe there was a patch somewhere to actually support 2.5D geometries in QGIS (rather than z values in an attribute column)…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s