[GIS] Workflow to convert a DWG CAD file to a shapefile

cadconvertdwgopen-source-gisshapefile

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?

Best Answer

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.