DXF to GeoJSON Converter
Export CAD elements as coordinates for modern web maps.
Converting DXF files directly to GeoJSON is a valuable way to display design and planning data on interactive web maps. However, CAD datasets must be assigned spatial locations to align correctly.
Indirect Mapping Execution Required
Because database connection attributes or local attributes parsing is required, direct web streams are disabled. Use the GDAL CLI script below for precise terminal conversions.
Specification Rules
- Publish engineering CAD layout plans directly to web dashboards
- Share vector drawing paths with web development teams as JSON objects
- Analyze structural outlines on top of public satellite base maps
- Design elements must be reprojected from local CAD origins to EPSG:4326
- Large architectural drawings will output very large text files
- Proprietary CAD blocks will flatten into standard point objects
GDAL Direct Equivalent Terminal Command
When to use this conversion
Use this guide when CAD design elements (engineering drawings, site plans) need to display directly on a web map. Convert to GeoJSON only after the DXF has been properly georeferenced — otherwise the data lands in the wrong country.
Technical Details
GeoJSON is typically 2–4× the size of the source DXF. ASCII DXF is verbose, but JSON adds per-feature property keys that often dominate for layer-rich CAD output.
Common Errors & Fixes
- Lines off-coast: missing source CRS. Fix: do not convert directly to GeoJSON — go through GeoPackage with an explicit -a_srs first.
- File enormous: CAD drawings can produce huge GeoJSONs. Fix: filter to the relevant layers with -where "Layer = 'BUILDINGS'" and reduce precision with -lco COORDINATE_PRECISION=6.
- Web map slow to render: too many features. Fix: simplify with mapshaper or generate vector tiles with tippecanoe.
- Text annotations missing: DXF text entities not exported by default. Fix: enable text via driver flags and serialise as properties on point features.
Alternative Tools
- Two-step ogr2ogr: dxf → gpkg with -a_srs, then gpkg → geojson with -t_srs EPSG:4326
- QGIS: load DXF, set CRS, export to GeoJSON in one dialog
- mapshaper.org for simplification of dense CAD geometries before web display
- tippecanoe for very large CAD-derived datasets — vector tiles instead of plain GeoJSON
Frequently Asked Questions
Why do my CAD lines show up in the ocean after conversion?
This happens when localized, unprojected CAD drawings are interpreted as latitude/longitude values. You must assign the correct source coordinate reference system (CRS).
Are multiple CAD drawing layers preserved?
Yes, GDAL includes a 'Layer' folder property in each feature, allowing you to filter vectors inside your web maps.
Is text lettering saved?
Yes. CAD labels and title text blocks convert to coordinate points containing the text content as field attributes.