1

Requirement: I have to read dxf files entities which can be 2D building dimensions or road etc. Then i have to place it over the map and return the coordinates just like labs.mapbox.com export the coordinates as geojson like the data below export by labs.mapbox.

Approch: For now i'm using python 'exdxf' package to read dxf file which return me entities information e.g in case of line it would be start/end points. Then i was thinking to draw those entities over a canvas (not sure) then place it over mapbox and get the coordinates where canvas is place export geojson of it is the final goal.

Required help in: Suggest me the right way to achieve this solution, i am open to choose any framework / language.

Thanks for your time

labs.mapbox.com geojson exported by labs.mapbox.com

Basit
  • 862
  • 1
  • 12
  • 30

1 Answers1

1

If you've got a dxf file and want to export it as a geosjon file, using ezdxf python package is good but you have to do a lot of processing the dxf entities and stuff and it takes time to achieve what you want.

I suggest using ogr2ogr since this is a time saving approach. it is a library for working with geospatial data and you can convert data to different formats such as Geojson, shapefile and others.

you can easily convert your dxf file to a geojson file with :

ogr2ogr -f Geojson GEOJSON_FILE_NAME YOUR_DXF_FILE_NAME 

I suggest reading the documentation first to get to know about this library and all the options it gives you for processing the data.

  • What if my dxf is not geo located? can i still able to create geo coordinate? – Basit May 26 '21 at 10:11
  • Thanks @fatemeh i tried ogr2ogr it does it work now i'm able to export dxf to geojson and can be disply over map – Basit May 27 '21 at 11:28