three.jsmapboxmapbox-gl-jsmapbox-glezdxf

Place dxf entities on mapbox and get coordinates of its like geojson of labs.mapbox.com/labs/dxf2geojson/dist/


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


Solution

  • 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.