I have a lot of DWG files like basemap, and water and wastewater network. I am looking for a way to import these files into my QGIS project.

  • 2
    try to convert your dwg-files to dxf with your cad-software (autocad) and then try to import this dxf-files via add vector-layer into qgis – Kurt Sep 3 '12 at 19:47
  • 1
    For QGIS 2.18 and later have a look for the answer from @Nightwatch below. – jurajb Jan 12 at 10:16

10 Answers 10

You can convert the DWG files to DXF (which QGIS does support) using the Teigha® File Converter. It's a free (not open source unfortunately) cross-platform application provided by the ODA to end users only for the conversion of .dwg and .dxf files to/from different versions.

The following platforms are supported:

  • Linux (OpenSUSE 11.2/Ubuntu 10.10 x86)
  • Mac OS/X (Snow Leopard x86 10.6 or later)
  • Windows (XP or later)

In the newer versions of QGIS (2.18+) there was a feature implemented to import .dwg-files into geopackages (.gpkg).

This feature can be found under:

Project >> DWG/DXF-import

In order to make it work, you can follow those steps:

  1. Create a new/load an existing Geopackage with a fitting CRS
  2. Import DWG-file
  3. Check 'Expand block references' and 'Use curves' if needed
  4. Set 'Group name' of your choosing
  5. Uncheck unwanted CAD-layers
  6. checking 'Merge layers' is advised

showcase of *.dwg import in QGIS

Some additional notes:

  • The tool will try to represent the CAD-drawing as close as possible with some limitations on annotations, labels and hatches.
  • some special features from addins and plugins etc for the AutoDesk CAD product family can break the import function of QGIS, like 'digital surface models'
  • This answer should go to the top – jurajb Jan 12 at 10:14
  • What's the geopackage part? – mapping dom Jan 31 at 12:38
  • I first missed the "go to [PROJECT] menu" part, and searched under [vector] - [import DXF]. Hope my comment helps someone NOT to miss this. – William Bligh May 8 at 9:27
  • I'm missing something here. Will it work with a dwg containing multiple different layer (points, lines and shapes)? When creating a new Geopackage, it is required to choose only one geometry type. – Rashomon Jul 3 at 15:28
  • @Rashomon In principle geopackages can contain any geometry type simultaneously, much like i.e. Spatialite- or GeoDB. When using the Import tool you will automatically create a new fitting geopackage by choosing a location and giving a new name. Answering your actual question: All readable layers will be imported into ONE geopackage – Nightwatch Jul 5 at 10:11

It depends on what you mean by import. Do you want to import data to actually do something with it, or just to have a background layer for viewing?

Also consider this: In GIS, basic building blocks are points, lines and polygons (sometimes called basic topological types), and in CAD, you are working with drawings which can be made of anything, including objects that cant be converted into any of before mentioned types. These would include more 'exotic' types of geometries like curves, solids, etc, also blocks (or block references), external raster references,...

ArcGIS for example does a pretty good job of displaying (and even allows limited editing) of DWG/DXF files, while other GIS software packages attempt to simply import the data as best they can, because the contents of a dwg file can be too complex to have a tool that would simply translate CAD -> GIS.

I often recieve cad files but I don't have AutoCAD, so I break them down with DoubleCAD XT which is a free download. I export each layer or set of data by selecting it then SAVE AS (toggle the selected option) type = DXF-2004-2006. These seem to import fine into QGIS, when you open it up as a vector layer.

FME server might be worth a try as well, http://fmeserver.com/userweb/sharper/Portal/EasyTranslator/index.html

but I find the layer by layer approach with DoubleCAD to be more robust.

To export,

  • point data - export via mmqgis plugin 'export geometry' to a csv.

  • vectors - save as dxf, then resave in DoubleCAD to a dwg. You cannot keep the attributes so you have to work with one feature of data at a time.

Another export option I have been using is DXF Author

found here

http://www.mmnt.net/db/0/0/priede.bf.lu.lv/pub/TIS/failu_paarveide/shp2dxf

with a user guide at

ftp://priede.bf.lu.lv/pub/TIS/failu_paarveide/shp2dxf/about.htm

  • NOTE: I just filled out a very long form to try to download DoubleCAD XT to find out that the software is for WINDOWS ONLY fyi all – boulder_ruby Oct 17 '13 at 18:59

As many have said open source software can not support dwg. Dxf however is supported and autodesk provides a cloud tool that you can use to convert dwg to dxf: autocad 360 (or the previous version autocad ws). The advantage of this tool over many others is that it support all versions of dwg, also the most recent ones.

Add the files and then under download you can download the files as dxf as well. enter image description here

there is a free online-tool for converting dxf and dwg to shapefile and kml here: http://acadconverter.chrismichaelis.com/v2012/, but I did not tested it in lack of a dwg

DWG is a proprietary, closed format. As many would be able to confirm is one of the less interoperable formats. Long story short: it is not possible to open a DWG file with an Open Source software/library. There are/were attempts to create an OS library to read dwgs but afaik they don not work very well. If there is software other than Autodesk that can open DWGs then it uses a non open source library to do that, for this reason you will not see DWG support in QGIS. As already suggested ask to have the DWGs saved as DXF (that is somehow more interoperable) or as shapfiles (Autocad map can do that).

Open Source gvSIG is said to capable of opening DWGs. From there, it should be possible to export to shapefiles. Not tested here I'm afraid.

  1. Open Source QCAD does simple and smooth conversion job from .dwg to .dxf format.
  2. Use the "add vector layer" feature in QGIS 2.0 to import the .dxf file. However, at this point of time I note that with the 32 bit QGIS version, it can only save as to a .kml file but with the 64 bit QGIS version, it can save as a .shp file.
  3. Dispose unwanted features in the .shp file with the rectangle, polygon, radius or freehand selection whichever you may prefer.
  • How do you exactly make the conversion, where is that option? I am trying but I can´t find how, there are a lot of comments in internet, but some say that qcad can not open dwg but I just open it with double-click from the windows explorer, I don´t know what to believe. – Nelly Jul 14 '15 at 18:11

Your easiest option is: http://www.guthcad.com.au/cad2shape.htm It is not free, but the company is specialized to convert cad dxf/dwg files to shape.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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