4

I want to read a .DWG file into R. DWG is on the list of supported OGR formats in GDAL:

Link

So in theory, I should be able to read in the .DWG file using readOGR() in rgdal. But I don't know how to define the dsn.

The ogrDrivers() command gives me the list of available drivers, but the list doesn't match the list of available OGR formats from the GDAL website.

According to the OGR page on DWG files, there should be a DWG driver, but it's not even on the list of OGR drivers in rgdal.

Does this mean that DWG files are not supported in rgdal, even though they are supported by OGR in GDAL?

Thanks very much.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
  • My previous (now deleted) comment may have referred to obsolete content. Perhaps [this info](http://trac.osgeo.org/gdal/wiki/DxfDwg) will help. – jbaums Mar 31 '14 at 04:30
  • Apparently not -- there's no mention of "dwg" in the help file. You may have to use AutoCAD or other apps to convert DWG into some other layout format. – Carl Witthoft Mar 31 '14 at 11:31
  • 2
    This requires a custom compile of GDAL. What OS do you use? – Mike T Apr 01 '14 at 09:37

1 Answers1

0

As indicated in the list of formats, DWG is not included by default, so you must compile GDAL/OGR with custom flags for it to be available. This is the case for formats that require an external library that cannot be packaged with GDAL/OGR.

So yes, it is supported, but not included by default, and not included in your installation either. Only installed/available drivers will be listed.

Benjamin
  • 11,560
  • 13
  • 70
  • 119