I would like to do what's needed in a GIS (GRASS, QGIS, etc) alone, no other converters-only.

The process is to read the dwg files that would be located in a folder and read them as shp and perform calculations like snapping later or using a geodatabase to store the files and later export them as shp.


ogr2ogr supports DWG to some extent: http://www.gdal.org/drv_dwg.html

So should be as easy as:

ogr2ogr shapefile.shp cad_file.dwg

  • 1
    And what is this? Just python with the ogr2ogr module? Clarify. What parameters takes and so. Thanks – user10138366 Jul 27 '18 at 10:42
  • 1
    ogr2ogr is a command line utility. I don't know if your on window or linux. But the easiest way to use it on windows is to use the OSGeo4W installer trac.osgeo.org/osgeo4w , then though the OSGeo4W Shell you can type in the provided command. – HeikkiVesanto Jul 27 '18 at 10:48
  • In the shp part u say the name it is going to have after conversion from dwg, and in the dwg part you say the file you want to convert? – user10138366 Jul 27 '18 at 11:13
  • Yep. That is correct. – HeikkiVesanto Jul 27 '18 at 11:29

What's wrong with Project -> DWG/DXF import in QGis?

  • i want to open in a loop all the files and then do calculations like snapping, etc . how do you suggest to do it like this? i tried uding that but it just opens the file one by one and it doesn't convert it to shp. i think – user10138366 Jul 27 '18 at 11:11
  • 1
    That's an important information, that you want to do batch processing. From the GRASS-tools, try v.in.dxf, maybe that helps. When incorporated into a graphical model, you may even run the whole process as a batch process. – Erik Jul 27 '18 at 11:30
  • Can it process dwg or only dxf? – user10138366 Jul 27 '18 at 11:47
  • Interface suggests it can process both. You'll have to try. – Erik Jul 27 '18 at 12:22

I have done the conversion CAD -> GIS several times, unfortunately, to your request, I performed with the usage of ArcGIS. However, I would like to highlight, that there is always a part left for a manual work due to the difference between GIS and CAD and humans factor in it. At least in my case, I worked with data that was acquired through the surveying.

The last time I did it, I have used a feature from ArcGIS toolbox, known as

ArcToolbox > Conversion Tools > To Geodatabase (CAD to Geodatabase)

I had lots of buildings, therefore some of them were not converted into proper polygons what they should be. Because of that, I used a function to transform unclosed polygons, i.e. polylines into polygons.

ArcToolbox > Data Management Tools > Features > Feature to Polygon

But you have to be careful since some of the polygons cannot be produced because of the distance between starting and ending point of the polyline.

Additionally, I can refer you to Converting polyline to polygon in ArcGIS Desktop for floodplain map? and How to close polylines that mark shape of cirque glaciers?.

With the development of QGIS, I can recommend the most common way, which was mentioned by Erik, to use

Layer > Add Layer > Add Vector Layer > AutoCAD DXF (*.dxf, *.DXF)

Alternatively, there is a bunch of plugins in QGIS, e.g. CADDigitize, Another DXF Importer / DXF2Shape Converter, CadInput etc. Can refer you to DXF Import QGIS: Text Components.

Not sure about ogr2ogr. Perhaps HeikkiVesanto is correct.

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.