Convert DXF file to RasterLayer

by ixodid   Last Updated April 16, 2019 03:22 AM

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

Tags : raster r dxf rgdal


Related Questions


Updated May 26, 2016 08:09 AM

Updated July 12, 2017 11:22 AM

Updated August 08, 2017 14:22 PM

Updated September 12, 2017 18:22 PM

Updated June 14, 2018 08:22 AM