DXF
Autodesk's CAD interchange format — the bridge between AutoCAD and the world.
- Specification
- Autodesk DXF Reference (annual; current AC1032/AutoCAD 2018)
- Released
- 1982
- When to use
- Use DXF when you need to move geometry between AutoCAD and a non-Autodesk tool — typically pulling a surveyor's site plan, a road centreline, or an architect's building outline into QGIS for further GIS analysis. DXF is a CAD format, not a GIS format: it has no CRS, no attribute tables, and no spatial indexing. Convert DXF to Shapefile or GeoPackage as early as possible in the workflow and assign a CRS.
What is DXF?
DXF (Drawing Interchange Format) was created by Autodesk in 1982 as a tagged ASCII representation of AutoCAD's DWG binary drawing format. A DXF file is a sequence of group-code/value pairs grouped into sections (HEADER, CLASSES, TABLES, BLOCKS, ENTITIES, OBJECTS) that together describe layers, line types, blocks (reusable symbol definitions), entities (LINE, LWPOLYLINE, CIRCLE, ARC, TEXT, INSERT), and their relationships. Coordinates are in the drawing's local coordinate system — there is no concept of a geographic CRS — and arcs, splines, and ellipses are represented as parametric curves rather than discretised polylines. When DXF is imported into a GIS, GDAL converts each layer into a separate OGR layer, splits entities by geometry type (points, lines, polygons), and approximates curves as polylines with a configurable arc segmentation tolerance. The first step in any DXF-to-GIS workflow is therefore to ask the surveyor what CRS the drawing is in, then assign that CRS with the -a_srs flag during conversion. Without that step, the geometry typically lands somewhere in the Gulf of Guinea, since unprojected drawing coordinates are interpreted as decimal degrees.
Supported by
- AutoCAD (native), BricsCAD, DraftSight
- QGIS (DXF import/export via GDAL)
- GDAL/OGR (driver: DXF)
- FME (deep CAD support)
- Global Mapper
- Inkscape (limited)
- Blender (via importer)
- ezdxf (Python library)
Strengths
- Universal CAD interchange — every CAD program reads it
- Plain ASCII — diffable, parseable without a binary spec
- Carries layers, blocks, line types, and styles
- Long-term stable — files from 1990s AutoCAD still open today
- Supports 3D geometry natively
Weaknesses
- No coordinate reference system — must be assigned manually
- No attribute tables — only layer names and entity properties
- Curves (arcs, splines) approximated when converted to GIS polylines
- Verbose ASCII — large drawings produce huge files
- Block references (INSERT entities) are not flattened by default
- DWG (binary AutoCAD format) is more compact but proprietary
Converters for DXF
Convert FROM DXF
Convert TO DXF
Frequently Asked Questions
Why do my CAD lines appear off the coast of Africa after I import a DXF?
Classic symptom. DXF has no CRS metadata, so the GIS interprets the raw drawing coordinates (often Easting/Northing in metres in a national grid) as if they were WGS 84 longitude/latitude in decimal degrees. Coordinates like (570000, 5650000) clip to (180°, 90°) and land at the (0,0) point in the ocean. The fix is to assign the correct source CRS during conversion with ogr2ogr -a_srs EPSG:<code>.
How do I figure out the CRS of a mystery DXF file?
Ask the supplier. If that fails: open the DXF in QGIS without a CRS, look at the coordinate ranges in the bottom status bar, and match them against known national grids (e.g., UK National Grid is around 0–700000 east, 0–1300000 north; German UTM zones 32/33 use 6-digit easting and 7-digit northing). Then assign that CRS as the source projection.
Does DXF carry attribute tables like Shapefile does?
Not in the GIS sense. CAD entities carry properties (layer name, colour, line type, elevation) and DXF supports XDATA (extended entity data) and dictionary attachments, but these don't map cleanly onto GIS attribute schemas. GDAL surfaces a small fixed attribute set: Layer, SubClasses, EntityHandle, Text — anything richer must be rebuilt downstream.
What's the difference between DXF and DWG?
DWG is Autodesk's binary drawing format — compact, proprietary, and the native format of AutoCAD. DXF is the ASCII interchange format meant for moving data between DWG and everything else. Most non-Autodesk tools can read DXF but not DWG without licensed libraries like Open Design Alliance's Teigha.
Why are my arcs jagged after converting DXF to Shapefile?
Shapefile cannot store true arcs — only polylines. GDAL approximates each arc as a sequence of straight segments controlled by the DXF_INLINE_BLOCKS and arc-segmentation options. Increase the segment count for smoother curves at the cost of larger files.