I'm trying to develop a workflow where I can convert a .dwg file to .shp. I don't have a good understanding of which tools I should be using. My preference is to use software that runs on OSX, is open-source (or free).

My current workflow is as follows:

  1. Convert .dwg to .dxf using Draftsight (http://www.3ds.com/products-services/draftsight/overview/ )
  2. Load .dxf into Sketchup
  3. Scale/rotate imagery in Sketchup and geolocate
  4. View in Google Earth

Once I reach step 4, I'm unsure how best to proceed. As far as I can tell, Google Earth is actually rendering a Collada model, and not loading a kml file that I can access, so I don't know how to extract the underlying file.

I thought about using ogr2ogr (http://www.gdal.org/ogr2ogr.html ) but I'm not sure if I can interact with a CAD file this way (as I need to specify the projection and location). I also have QGIS and PostGIS available. I also considered FME but would prefer not to have to have a Windows OS just for this conversion process. I've also read through the following related question: Transforming from DWG/DXF to GIS?

  • It depends on how many you have. If it's a one-off or occasionally you could open in QGIS and then save as for each feature type that you need. I have used OGR2OGR in a windows batch environment with satisfactory results as I had over 20k drawings to convert that time. FME is a very big hammer for a very small nail in this case, unless you have other tasks I would steer clear of that. One thing to be aware of is local datums which CAD files are often in; by the sound of your workflow this is the case as you need to geolocate, you will still need to do this and I think QGIS can do the task. Commented Apr 8, 2014 at 2:02
  • @MichaelMiles-Stimson I don't have a large number, but it is a task I will need to repeat every few weeks. I haven't had much luck opening the dxf in QGIS - do you have any pointers?
    – djq
    Commented Apr 8, 2014 at 3:06
  • 1
    DWG and DXF are OGR formats gdal.org/ogr/drv_dwg.html but QGIS doesn't offer a filter for the DWG. It may still support them though. I've not had a problem with DXF in QGIS but they were all georeferenced, perhaps QGIS is having difficulty with local coordinates or the AutoCAD version isn't supported. You should be able to do OGR2OGR directly without georeference - the default is shape file. You will probably need to find a plugin to geolocate; in the repository there is an affine plugin which may serve your needs. Commented Apr 8, 2014 at 3:49
  • i think FME supports linux ( but not necessarily all file formats) see : safe.com/support/support-resources/fme-downloads there is linux version Commented Apr 8, 2014 at 7:00
  • I would recommend looking at How to convert a Visio diagram to a GIS layer, which covers the process of converting a DXF file to shapefile. Commented Apr 12, 2014 at 4:05

3 Answers 3


Once you coverted the DWG to DXF you should be able to use GDAL/OGR. Note that you have to use DXF version 2000 (http://www.gdal.org/ogr/drv_dxf.html).

I have recently used ogr2ogr with the -gcp (ground control point) option (http://www.gdal.org/ogr2ogr.html) successfully to geolocate DXFs.

Thus, with ogr2ogr you can covert the DXF to Shapefile and gelocoate it in one step. Note that if you have mulitiple input files (DWGs/DXFs) you may have to use different GCP sets.

If you want to aviod the limitations of the Shapefile format (http://en.wikipedia.org/wiki/Shapefile#Limitations) you may have to consider to covert (and upload) the DXF to a spatially enabled DB, most preferably PostGIS.

Finally visualise in QGIS.

  • Thanks, I'm familiar with Postgis, so happy to store it there; how do I go about using the ground control point with ogr2ogr? Do I need a point (or points) of reference for the geolocation and within the CAD file?
    – djq
    Commented Apr 12, 2014 at 23:33
  • There's a free autocad plugin for google drive which is what I use to deal with CAD. I then use arc but the free plugin for G-drive might have different output options Commented Apr 13, 2014 at 0:40
  • You can try something like this: ogr2ogr -overwrite -f PostgreSQL PG:"dbname='<dbname>' ..." -gcp CADCoordX1 CADCoordY1 WorldCoordX1 WorldCoordY1 -gcp CADCoordX2 CADCoordY2 WorldCoordX2 WorldCoordY2 -gcp ... -gcp CADCoordXn CADCoordYn WorldCoordXn WorldCoordYn -nlt "<geometry_type>" -a_srs <CRS> -skipfailures <source_file.dxf>
    – aberenyi
    Commented Apr 14, 2014 at 9:30

You say that you're open to using FME for this but don't want to run in a Windows environment. Good news, as of FME 2014, FME now runs on a Mac as a "technical preview".

With FME, you can bypass many of your intermediate steps and go straight from DWG to Google Earth.

I would have open a DWG reader and connect it to a Trimble Sketchup Writer. You can geolocate in Sketchup if needed, and then export to Google Earth.

Alternatively, if you know the transformations required to geolocate the CAD files you can do all the transformations directly in FME. To do that, you may need to create "shift vectors" and use the rubbersheeter transfmormer. Alternatively, there is a scaler transformer, rotator, and many others to get the job done.

Then you can skip the Sketchup step altogether and write directly to a KML.

  • FME is what usually works best with the, slightly complicated, DWG format, in my experience.
    – Martin
    Commented Apr 17, 2014 at 10:31
  • Is it also possible to directly save it as a shapefile?
    – djq
    Commented Apr 17, 2014 at 13:25
  • Yes, FME will convert between over 300 different formats. Shapefile included.
    – Fezter
    Commented Apr 17, 2014 at 20:11

If you have access to Autocad map 3D you can export point, polylines and lines into shapefiles that you can import into Qgis. If there is attached data you would be able to have it associated with the shapefiles and have it showing up in the attributes table when loaded in Qgis

  • Unfortunately I do not have Autocad map 3D, but it's useful to know it's possible within that software.
    – djq
    Commented Apr 8, 2014 at 13:37
  • Do you have access the ArcGIS software? Commented Apr 11, 2014 at 17:26
  • It's mapexport command in Autocad Map 3D if you have one.
    – Greg
    Commented Apr 12, 2014 at 8:41
  • Unfortunately, I do not have access to ArcGIS either
    – djq
    Commented Apr 12, 2014 at 18:04

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.