0

I am an R user and have a .dwg file of city buildings that I wish to transform into a RasterLayer using the heights as elevation data.

The metadata for the DXF file states:

DXF File Metadata: Projection - MTM 3 Degree Zone 10 NAD27, WGS84 Latitude/Longitude

What is the recommended workflow to do this? I am on a Mac if that is helpful.

Since .dwg is proprietary I converted it to .dxf using ODAFileConverter.app

Still, it's not clear to me as to how to read the file.

Is there geolocation type data in the DXF file? Can that become part of the RasterLayer?

QGIS 3.6 crashes if I try Project > Import/Export > Import Layers from DWG/DXF with the DWG file. If I try the DXF file it just creates a single line. I know the file is good because I can view it OK with Autodesk's Online Viewer.

library(rgdal)
file = "50G_SOUTH2.dxf"
ogrListLayers(file)

[1] "entities"
attr(,"driver")
[1] "DXF"
attr(,"nlayers")
[1] 1
ogrInfo(file)
Error in ogrInfo(file) : Multiple # dimensions: 2:3

35 MB DWG file is here

278MB DXF file is here

  • Try reading it with the sf package? sf::st_read("filename.dxf") - because sf objects are better at handling multiple dimensions (at a guess I suspect the data contains points, lines, and polygons) – Spacedman Apr 16 at 8:07
  • No go. Error in st_sfc(NextMethod(), crs = st_crs(x), precision = st_precision(x)) : found multiple dimensions: XY XYZ – ixodid Apr 18 at 0:45
  • Ah yes its an extra dimension as well as multiple geometry types... If I can make a file with multiple dims I'll have a go (can't really d/l 278MB at the moment). – Spacedman Apr 18 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.