DWG, DXF, DGN and Shapefile: CAD and GIS File Formats Compared

DWG, DXF, DGN and Shapefile: CAD and GIS File Formats Compared

A few years ago I received two files for the same road project on the same morning. One was a DWG from the design office, the other a Shapefile from the municipality’s GIS team. Both described the road. Both were “correct”. When I loaded them into the same map, the DWG showed a magnificent drawing with fifty layers, dimension lines, hatching and a title block, and the Shapefile showed a plain set of lines with a table of attributes. The design office said the GIS file was “missing everything”. The GIS team said the DWG was “full of junk and had no data”. They were both right, because each file was doing the job it was designed for, in the language of its own world.

Understanding why the formats differ is the key to moving data between the CAD and GIS worlds without losing information or your temper. A file format isn’t just a container. It embodies a way of thinking about the world. The DWG thinks in terms of drawings. The Shapefile thinks in terms of features and attributes. Each decides what can be stored, what is lost and what is left to the software to guess.

In this guide I’ll explain the four formats you will meet most often, DWG, DXF, DGN and Shapefile, with a look at their modern GIS and exchange companions. We’ll compare what each stores and doesn’t, how each handles coordinates, attributes, geometry and 3D, which software reads and writes them, and how to choose the right one for each task. It is part of our Autodesk series, and complements CAD vs. GIS: What Is the Difference and When to Use Each? and the overview in Autodesk Software for GIS Professionals: Complete Overview.

Chart: DWG and DXF come from Autodesk, DGN from Bentley and Shapefile from Esri; each has strengths and weak points for GIS.
DWG and DXF come from Autodesk, DGN from Bentley and Shapefile from Esri; each has strengths and weak points for GIS.

The Four Formats at a Glance

FormatOriginBest known forNatural home
DWGAutodesk (AutoCAD)The native drawing file of AutoCAD, the dominant CAD file in architecture, engineering and constructionDesign and drafting
DXFAutodeskAn exchange format for CAD drawings, with a published specificationExchange between CAD programs and other software
DGNBentley Systems (MicroStation)The native file of MicroStation, widely used in transportation and infrastructure, particularly by public agenciesDesign and engineering in the Bentley ecosystem
ShapefileEsriThe most widely exchanged GIS vector format, made of several linked filesGIS data exchange

Each of these four has newer or related companions that we’ll meet below: GeoPackage, file geodatabases, SDF, LandXML, IFC and GeoJSON.


DWG: The Drawing

What it is

DWG is the native file format of AutoCAD, and has been the working format of the design world for four decades. A DWG file stores a complete drawing: its geometry, layers, blocks, text styles, line types, layouts, settings and more.

It is a proprietary format. Autodesk controls it, and has changed it over the years, releasing new versions with each major generation. Several other companies and organizations offer libraries that read and write DWG files, notably the Open Design Alliance, which provides a toolkit used by many programs. Open-source tools often have limited DWG support, because the format isn’t publicly documented in the way DXF is.

What a DWG contains

  • Entities: lines, polylines, arcs, circles, ellipses, splines, points, text, multi-line text, hatches, dimensions, leaders, 3D faces, meshes, solids, surfaces, regions and images.
  • Layers: organizing and styling groups, each with a color, line type, visibility and lock state.
  • Blocks: reusable symbols, inserted as references, which can carry block attributes (named text values attached to each insertion).
  • External references (xrefs): links to other drawings, images and point clouds, whose content is displayed but stored elsewhere.
  • Layouts and viewports: paper space sheets for plotting, at chosen scales.
  • Styles and standards: text styles, dimension styles, plot styles and line types.
  • Drawing settings: units, limits and various system variables.
  • Extended data and custom objects: applications can attach their own data and define their own object types.
  • Coordinate system information, in drawings that have had one assigned by Map 3D or Civil 3D. See Coordinate Systems in AutoCAD Map 3D and Civil 3D Explained.
  • Object data and classification, in drawings created with Map 3D. See Object Data, Object Classes and Attributes in AutoCAD Map 3D.
  • Civil objects, in drawings created with Civil 3D: surfaces, alignments, corridors, parcels, pipe networks and more. These are custom objects that only software that knows them can interpret. Others see them as simplified “proxy” shapes, or not at all.

Versions

DWG changes over time. The version is stored in the first six bytes of the file as a code beginning with “AC”, such as AC1032. Older software can’t open newer versions, while newer software can open older ones. The version used by recent AutoCAD releases has been stable for several years, but it will change again. When you exchange DWG files with others, ask which version they can read, and use Save As to an older version if needed. This is a frequent source of “this file won’t open” problems. See DWG Import Errors in QGIS and ArcGIS (Blocks, 3D Faces, Encoding).

Strengths

  • The industry standard for design deliverables. Almost every engineer, architect and surveyor can open it.
  • Rich: it preserves the whole drawing, including layouts, styles and references.
  • Precise: double-precision coordinates and sophisticated geometry.
  • Extensible: supports custom objects and data.

Limitations for GIS

  • Proprietary: support outside Autodesk and licensed toolkits can be partial.
  • No standard attribute table: data lives in text, block attributes, extended data or object data.
  • No guaranteed coordinate system: many drawings have none.
  • Mixed content: one drawing may hold lines, text, hatches and symbols on a single layer.
  • Version dependence.
  • Large files with a lot of history and unused definitions. See Corrupted or Bloated DWG Files: Audit, Recover and Purge.

DXF: The Exchange Format

What it is

DXF (Drawing Exchange Format) was created by Autodesk to allow drawings to be exchanged with other programs. Unlike DWG, its structure is published, which is why nearly every graphics, CAD and GIS program can read and write it. A DXF is a structured text file (an ASCII version is the most common, and there is a binary variant) made of pairs of numbers and values that describe the drawing.

What a DXF contains

Most of what a DWG contains: entities, layers, blocks, line types, text styles and, in later versions, many other objects. But there are important differences.

  • Not everything survives. Complex custom objects, such as those created by Civil 3D, usually aren’t carried, or are reduced to basic geometry or placeholders. Object data and some extended data may be lost.
  • Version-specific. DXF has versions that correspond to DWG versions. Older DXF versions (such as the 1990s R12 version) are simplest and are the most widely supported, but have fewer capabilities: for example, they treat polylines differently and don’t support the same text.
  • Text encoding differs by version. Older DXF files use a code page declared in the file, which causes accented and non-Latin text to display incorrectly if the reader guesses wrongly. Newer DXF versions use Unicode (UTF-8). See Shapefile Limitations and Encoding Problems (Field Names, UTF-8) for how encoding problems work.
  • Large and slow. Text-based files are bigger and slower than DWG.

Strengths

  • Open and widely supported: the safest way to pass a drawing to software that doesn’t read DWG, including open-source GIS tools.
  • Human-readable in a text editor (in the ASCII form), which helps with diagnosis.
  • Scriptable: libraries exist to read and write it in many programming languages.

Limitations

  • Loss of fidelity, especially with advanced objects.
  • Version pitfalls.
  • No attribute table, like DWG.
  • No guaranteed coordinate system.

When to use DXF


DGN: The MicroStation Format

What it is

DGN is the native format of MicroStation, the CAD and engineering platform from Bentley Systems. It’s widely used in civil engineering, transportation and infrastructure, particularly by public agencies in some countries, and by organizations that use Bentley’s engineering software. There are two main generations: the older V7 format and the newer V8 format, which introduced many capabilities. Some of the newer files use updated structures.

What a DGN contains, and how it differs from DWG

  • Levels play a role similar to CAD layers.
  • Cells are the DGN equivalent of blocks: reusable symbols.
  • Reference files are attached external files, like xrefs.
  • Master units and sub-units: DGN defines units differently, based on a base resolution of the design space. Misreading units is a common problem when working with DGN files in GIS.
  • Design plane limits: a DGN design has a defined coordinate space. Data may lie at the extremes of this space, or be positioned relative to a “global origin”.
  • Element types: lines, shapes (polygons), complex chains, text, cells, curves and 3D elements.
  • Attributes can be linked to elements, in a manner specific to the system, or held in a connected database.

Reading DGN in GIS

Many GIS programs read DGN, with variations in support for the different versions and options. Esri software reads DGN datasets directly, and the open-source GDAL library has a driver for the older generation, and may rely on additional components for the newer one. Check the support in your tools. In practice, data is often converted from DGN to DXF, a geodatabase or a Shapefile for GIS use.

When you will meet it

If you work with a transport department, a utility or an engineering consultancy that uses Bentley software, you may receive DGN files. Ask for a DXF or DWG export if your tools can’t read the DGN directly, and ask about units and coordinate systems.


Shapefile: The GIS Exchange Standard

What it is

The Shapefile, created by Esri, is a collection of files with the same base name: .shp (geometry), .shx (index), .dbf (attributes), .prj (coordinate reference system), and optionally others such as .cpg (encoding). It became the most widely exchanged GIS vector format in the world, and nearly every GIS, and many CAD programs, can read it. See Shapefile vs. GeoJSON vs. GeoPackage: Which Format to Use? for the broader comparison and Shapefile Limitations and Encoding Problems (Field Names, UTF-8) for its quirks.

How it thinks

A Shapefile is one feature type per file (points, lines or polygons), with an attribute table holding one row per feature, and a coordinate reference system in the .prj file. It carries no drawing styles, no text objects, no blocks, no layouts and no multi-layer structure. That simplicity is both its strength and its limit.

Strengths

  • Universal: the lowest common denominator between GIS systems.
  • Attributes are central.
  • Real-world coordinates, with a defined CRS (when the .prj is present).
  • Simple and robust for exchange.

Limitations

  • Ten-character field names, 254-character text, no true date-time, no true NULL for numbers and a 2 GB size limit.
  • A bundle of files that can be separated or damaged.
  • One geometry type per file.
  • No curves, so arcs become segments.
  • No styling or annotation. All the cartographic richness of a drawing is lost.
  • Weak 3D: Z values can be stored, but it is not a model format.

The Modern Companions

GeoPackage

An open OGC standard, stored in a single SQLite file. It supports many layers in one file, long field names, many data types including date-time, true NULLs, UTF-8 text, large size and spatial indexes. It’s the best general-purpose format for GIS work today. See Shapefile vs. GeoJSON vs. GeoPackage: Which Format to Use?

File geodatabase

Esri’s proprietary file-based database format, a folder of files, with support for many layers, relationships, domains, subtypes and topology. It’s widely used in organizations that run ArcGIS. See Lock Files and Corrupted Geodatabases: Recovery Guide.

SDF

Spatial Data File, a file-based format developed by Autodesk for its FDO data access technology, historically used with AutoCAD Map 3D to store GIS features with attributes and a coordinate system in a single file. It’s less used outside the Autodesk ecosystem, though it still appears.

LandXML

An XML format for civil engineering and survey data: surfaces (TIN), alignments, profiles, parcels, pipe networks and survey points. Civil 3D and many survey and design applications read and write it. It’s valuable for exchanging design data between civil software and for bringing surfaces and alignments into other systems.

IFC

Industry Foundation Classes, the open, vendor-neutral standard for BIM data, describing buildings and their components, with properties and relationships. It is the bridge between BIM software and other systems. See BIM and GIS Integration: Revit, IFC and CityGML.

CityGML and CityJSON

Standards for semantic 3D city models, at the geographic scale. See Digital Twins and 3D GIS.

GeoJSON

A simple, open, JSON-based format for vector features, always in WGS 84 longitude and latitude, and the standard of web mapping. See How to Create a Web Map (Leaflet, Mapbox, OpenLayers).

Rasters and point clouds

GeoTIFF for georeferenced imagery and grids, and LAS and LAZ for point clouds, are exchanged between CAD and GIS in both directions. See Aerial Imagery and Rasters in AutoCAD Map 3D and Civil 3D and Point Clouds with ReCap, Civil 3D and GIS.


Side-by-Side Comparison

AspectDWGDXFDGNShapefileGeoPackage
OwnerAutodeskAutodesk (published spec)BentleyEsri (published spec)OGC (open standard)
OpennessProprietaryDocumentedProprietaryDocumentedOpen standard
Typical userDesigners, engineersAnyone exchanging drawingsBentley usersGIS usersGIS users
StructureOne fileOne fileOne fileSeveral filesOne file
GeometryFull CAD geometry, 2D and 3DMost CAD geometryFull CAD geometryPoints, lines, polygonsPoints, lines, polygons, and more
CurvesYesYesYesNo (segmented)Possible, in some implementations
Mixed types in one datasetYesYesYesNoYes (in separate layers)
Attribute tableNoNoLimitedYes (dBase, limited)Yes (rich)
Text and annotationYesYesYesNo (needs separate handling)Limited
Blocks or symbolsYes (blocks)YesYes (cells)NoNo
Styling and layoutsYesPartlyYesNoStyles can be stored
Coordinate systemOptional, often missingRarely storedDefined in a way specific to the systemYes, in the .prj fileYes, in the file
UnitsDefined by the author, sometimes unreliableSameMaster and sub-unitsDefined by the CRSDefined by the CRS
Multiple layersYes (CAD layers)YesYes (levels)One per fileMany
3DRichPartlyRichLimitedLimited
Size limitsLarge files practicalLarger, text-basedLarge2 GB, 254-character textVery large
Best useDesign and draftingExchange between CAD and othersBentley designGIS exchangeGIS storage and exchange

How CAD Objects Become GIS Features

When you move data from CAD to GIS, every drawing object must be turned into a feature. The mapping is not always obvious.

CAD objectWhat a GIS usually makes of itNotes
LineA line featureStraight, two vertices
Polyline (open)A line featureCheck connectivity at the ends
Polyline (closed)A line forming a ring, not automatically a polygonNeeds conversion to a polygon. See Fixing Topology Errors and Overlaps
Arc, spline, ellipseA line approximated by many segments, or a curveCheck how finely it is approximated
CircleA polygon approximating the circle, or a point with a radiusDepends on the tool
PointA point featureOften used for survey points
Text and multi-line textA point (the label position) with a text attribute, or an annotation featureText is data about something else. It is not the thing itself
Block insertionA point at the insertion position, with the block name, and possibly attributes. Or exploded into its component geometrySymbols and attributes can be recovered from blocks
HatchA polygon built from its boundary, or ignoredHatches are fills. The boundary may be a separate polyline
DimensionUsually ignored, or turned into lines and textDimensions are drafting content
3D face, mesh, solidA 3D geometry, if the format supports it, or ignoredMany 2D GIS formats can’t hold them
Image referenceA raster, if georeferencedNeeds a world file or a coordinate system
External referenceContent that is only there if the referenced file is foundMissing xrefs are a very common cause of “empty” results
Civil 3D custom objectA proxy shape, or nothingExport to basic geometry from Civil 3D first. See Civil 3D Data Shortcuts and Xref Problems

The principle: a drawing is a picture of objects, and a GIS needs the objects themselves. The work of conversion is to turn the picture back into objects.


What Gets Lost in Translation

Be aware of the typical losses at each step.

CAD to GIS

  • Styling: colors, line types and weights, hatching, drafting symbols.
  • Layout and paper space: sheets, viewports and title blocks.
  • Curves: replaced by segments.
  • Text formatting.
  • Custom object intelligence: a Civil 3D pipe becomes lines.
  • References: missing xrefs.
  • Object data and extended data, unless explicitly exported.
  • Precision: conversions may round coordinates.

GIS to CAD

  • Attributes: the attribute table, unless exported to a form the CAD software can hold (such as object data or block attributes).
  • Coordinate system information, if the CAD file can’t store it.
  • Field names and types.
  • Long text values.
  • Relationships and domains.
  • Symbology, which the CAD side reproduces with layers, colors and blocks.
  • Large datasets, which CAD programs struggle with.

Controlling the loss

  1. Decide in advance what must survive: coordinates, attributes, geometry, symbols.
  2. Choose a format that can hold it.
  3. Map layers and fields explicitly.
  4. Test with a small sample, and compare the result with the source.
  5. Document what is lost and why.

Software Support at a Glance

Support varies by version, so treat this as a guide to what to check.

SoftwareDWGDXFDGNShapefile
AutoCAD, Map 3D, Civil 3DNativeRead and writeImport and export (support varies)Import and export with Map 3D and Civil 3D tools
ArcGIS ProReads as a CAD dataset. Convert and export tools availableReads and exportsReadsNative
QGISNot read directly in most installationsReads through the OGR library, and exports to DXFReads some versions, through OGRNative
GDAL and OGRLimited, depends on build and additional componentsRead and writeRead (older version), others with extra componentsRead and write
MicroStationReads and writesReads and writesNativeCan import and export with the right tools
FME and similar integration toolsReads and writesReads and writesReads and writesReads and writes
Free viewersSeveral free DWG viewers exist, from Autodesk and othersYesSomeYes

When you can’t read a DWG directly, a common practice is to convert it to DXF with a free converter, such as those offered by Autodesk and by the Open Design Alliance. We cover the details in Working with DWG and DXF Files in GIS (QGIS, ArcGIS, GDAL).

You can see which of these formats your installation of GDAL supports:

# List the vector formats GDAL can read (look for DXF, DGN, CAD and ESRI Shapefile)
ogrinfo --formats | grep -i -E "dxf|dgn|cad|shapefile|gpkg"

Choosing the Right Format

SituationBest formatWhy
Delivering a design to a contractorDWG (plus PDF plots)The industry standard, with all layers, blocks and layouts
Sending a drawing to someone without CAD softwareDXF or PDFWide support
Bringing a design into a GIS for analysisConvert to GeoPackage, after cleanupReal-world coordinates and attributes
Sending GIS data to a CAD teamDXF or DWG for linework, with layers and a documented coordinate system. A Shapefile or GeoPackage if their software reads itMatches their tools
Exchanging civil surfaces and alignments between design programsLandXMLPreserves civil structure
Exchanging building modelsIFCOpen BIM standard
Archiving authoritative GIS dataGeoPackage or a geodatabaseAttributes, metadata and structure
Publishing on the webGeoJSON, tiles or web servicesWeb-friendly
Exchanging with Bentley usersDGN or DXFTheir native or neutral format
Delivering a rasterGeoTIFF with its coordinate systemGeoreferenced
Delivering a point cloudLAS or LAZStandard

A good practice for any CAD-GIS delivery: provide the native file, a neutral exchange file, a plotted PDF, a note with the coordinate system and a list of the layers and attributes. The more of these you provide, the fewer questions you will receive.


A Worked Example: The Road Project, Revisited

Return to my opening story: the DWG from the design office and the Shapefile from the municipality.

  1. Understand each file. The DWG holds the design (alignment, edges, kerbs, drainage, annotation) in a drawing with 50 layers. The Shapefile holds the municipality’s road centerline, with attributes such as name, class, surface and owner.
  2. Check the DWG’s coordinate system. It has none assigned, and its coordinates are near a local origin. The designers confirm that the project is tied to the national grid by an offset from a survey control point. See Missing or Wrong Coordinate System in AutoCAD Drawings.
  3. Convert the DWG for GIS use: save a DXF (or read the DWG directly if the tool supports it), select the layers that matter (road edge, centerline, drainage), and convert them to a GeoPackage, assigning the national grid CRS. See Working with DWG and DXF Files in GIS (QGIS, ArcGIS, GDAL).
  4. Clean the data: convert closed polylines to polygons where needed, remove dimensions and hatches, check connectivity.
  5. Add attributes: the design’s attributes are in text labels and a spreadsheet. Join them to the features.
  6. Overlay the two datasets: the design centerline against the municipality’s road line, and the road edge against the parcels. Check the alignment at several places.
  7. Document: layer mapping, CRS, date, accuracy, what was left out.
  8. Return to the design office a DXF of the municipality’s roads and parcels in the project’s CRS, with layers named by theme, so that the designers can work in the real context.

The two files were never in competition. They were two views of the same road, and the job was to connect them.


Common Mistakes

  • Treating DXF as “the same as DWG”. Information is lost, and text encoding may differ.
  • Ignoring the DWG version and wondering why a file won’t open.
  • Forgetting external references, and receiving a drawing with missing content.
  • Assuming a DWG has a coordinate system.
  • Ignoring units, whether drawing units or DGN master and sub-units.
  • Assuming closed polylines are polygons.
  • Converting everything, including dimensions, title blocks and hatches.
  • Expecting attributes to exist where there is only text.
  • Using Shapefile as an archive for CAD-derived data, and losing meaning with the 10-character field names.
  • Mixing design and as-built content in the same file without labels.
  • Sending a GIS layer to CAD users with no coordinate system documentation.
  • Skipping a PDF or a layer list, which are the cheapest ways to confirm that you have the right content.
  • Not testing a conversion on a small sample before running it on thousands of files.

Final Thoughts

None of these formats is better than the others. Each is a tool for a task. The DWG records a design with astonishing richness. The DXF carries the essentials to places the DWG can’t go. The DGN serves another large engineering ecosystem. The Shapefile, for all its limits, speaks to every GIS on Earth. A professional who works across them knows what each can hold, what each will drop and how to ask for the right deliverable.

Take a drawing you have access to, and write down a list: what does it contain that a GIS needs (coordinates, layers, attributes) and what does it contain that a GIS doesn’t (dimensions, hatching, title blocks)? That list is the specification of your conversion. It will make every file you receive from now on easier to deal with.

Where to go next: put this into practice in Working with DWG and DXF Files in GIS (QGIS, ArcGIS, GDAL), and learn how Autodesk software handles coordinates in Coordinate Systems in AutoCAD Map 3D and Civil 3D Explained.

Rachid Khouri

Rachid Khouri

Rachid Khouri is a CAD, BIM and GIS professional, Autodesk Authorized Developer, trainer and technical author with more than 30 years of experience, working with AutoCAD since 1992. He founded GISauthority.com to share practical guidance on GIS and spatial technologies.