How can i convert my CAD(DWG) file to GeoJSON?

mahdi n75 picture mahdi n75 · Aug 29, 2016 · Viewed 11.6k times · Source

I'm working on openlayers and need to change the format of dwg to GeoJSON with ArcGIS. how can i do this?

Answer

jOshT picture jOshT · Sep 1, 2016

Indeed, GDAL has the necessary tools to get this done. ogr2ogr is a program included with GDAL that can transform a variety of formats, including DWG. If you don't already have GDAL installed, here are good tutorials for windows and mac/linux. The following guide recommends converting to a DXF first, since the library for converting from DXF is included by default with GDAL. You will need to install some additional dependencies to convert directly from DWG. If you convert to DXF first, you can then use command line to convert to GeoJson:

ogr2ogr -f GeoJSON ./mynewfile.geojson ./mycadfile.dxf

If you are using ArcGIS Desktop there is a CAD to Geodatabase tool that you can use.