DXF vs KML — Which Is Better for Maps?

DXF is optimized for CAD and engineering, KML for Google Earth visualization and web maps. These formats solve fundamentally different problems.

Criteria DXF KML
CAD compatibility✓✗
Google Earth✗✓
Coordinate precision✓✓
Visual styling✗✓
True scale 1:1✓✗

When to use DXF

For engineering projects, master plans, CAD work.

When to use KML

For map visualization, presentations, Google Earth.

What is DXF?

Example OpenStreetMap map exported to DXF
DXF: an OpenStreetMap map exported by osm2cdr.

DXF (Drawing Exchange Format) was published by Autodesk in 1982 together with early AutoCAD as an openly documented way to move drawings between programs. Autodesk still publishes a reference for each release, so almost every CAD, CAM and GIS package reads it.

A DXF file is organised into sections: a header, tables for layers, line types and text styles, a blocks section and an entities section with lines, polylines, hatches and text. Geometry is stored as raw X, Y and Z values in drawing units, and recent versions can add a GEODATA object that ties the drawing to a coordinate system.

Software that opens DXF

AutoCAD and AutoCAD LT, BricsCAD, NanoCAD, KOMPAS-3D, FreeCAD and LibreCAD open DXF directly, and so do QGIS, Global Mapper and most laser-cutter and CNC software.

Where DXF is strong

Reach is its main strength: when you do not know which program the recipient uses, DXF is the safest bet. Because it is text, it can be inspected or generated by scripts, and layers, colours, line types and blocks survive the trip between applications.

Limitations of DXF

Text encoding makes files several times larger than the equivalent DWG, so big drawings load slowly. Newer AutoCAD-only objects may be simplified by other programs, and many programs ignore the GEODATA object, so the receiver may still need to be told which coordinate system was used.

What osm2cdr puts into a DXF file

osm2cdr writes a text DXF (version R2007) with the map split into named layers — roads, buildings, water, green areas, boundaries and points of interest — keeping colours and line types. By default the drawing is in metres in the UTM zone of the area, or in the national grid where one exists, so it can be measured right after opening; a GEODATA object records the system, and an explicitly chosen one adds a .prj in a ZIP.

What is KML?

Example OpenStreetMap map exported to KML
KML: an OpenStreetMap map exported by osm2cdr.

KML (Keyhole Markup Language) was developed by Keyhole, the company behind Google Earth, which Google acquired in 2004. Google later handed it to the Open Geospatial Consortium, and KML 2.2 became an OGC standard in 2008.

A KML document is XML: placemarks with points, lines and polygons are organised in folders, each with a name, a description and optional ExtendedData attributes. Styles define icons, line widths and fill colours; altitude modes and extrusion let features rise above the ground; network links and ground overlays pull in external content.

Software that opens KML

Google Earth Pro and Google Earth on the web open KML with a double click or a drag; Google My Maps, QGIS, ArcGIS, Global Mapper, Marble and many mobile apps import it.

Where KML is strong

KML is built for presentation: a client can explore the data on a globe without GIS skills, click a feature to see its attributes and switch folders on and off. As text it is easy to generate, inspect and edit.

Limitations of KML

It supports only WGS 84, files grow quickly because XML is verbose, and styling is limited to what Google Earth understands. It is a poor fit for analysis: attribute schemas are loose, and large datasets slow the viewer down.

What osm2cdr puts into a KML file

osm2cdr places each layer in its own folder, keeps the OSM tags of every feature in ExtendedData and gives lines and fills a colour and width. Roads, water and greenery lie on the ground, while buildings are extruded to the height from their tags, so Google Earth shows a three-dimensional city straight away.

Key differences explained

At the most basic level, DXF is an openly documented CAD drawing exchange format, while KML is an XML format for showing geographic data on a virtual globe. On disk, DXF is usually plain ASCII text, which makes files large but readable; KML is plain XML text.

Here is what the comparison table above means in practice, point by point:

Example OpenStreetMap map exported to DGN
A related export: the same kind of map in DGN, a format often used next to DXF.

In short: choose DXF when the drawing has to open in any CAD, CAM or GIS program, including ones you do not know in advance. Choose KML when the result is shown on a globe to a client, colleagues or students.

DXF or KML: which one fits your job?

An engineer needs the surroundings of a construction site as a drawing base. DXF provides metres in a projected grid, so offsets, distances and areas can be measured right away.

A project manager wants to show the same site to a client in Google Earth. KML lands on the globe with a folder per layer and extruded buildings, and the client needs nothing beyond Google Earth.

You are checking an alignment drawn in CAD against satellite imagery. Exporting the OSM context as KML for Google Earth gives a quick visual check, while the design work itself stays in DXF.

Pitfalls when switching between DXF and KML

KML stores longitude and latitude in degrees, so importing it into CAD without reprojection produces a tiny, distorted drawing. Converting DXF to KML requires a known coordinate system, otherwise the drawing lands in the wrong place on the globe — the GEODATA object in the osm2cdr DXF and the optional .prj help converters get that right. Styling does not translate well in either direction: CAD colours and line types become plain lines, and KML icons have no CAD equivalent.

For a coordination meeting, sending both files is common practice: the engineer keeps the DXF, everyone else opens the KML on a laptop or a tablet.

Which to pick on osm2cdr

On osm2cdr, pick DXF when you will measure and draw. Pick KML when you will show and discuss the site, especially with people who do not use CAD software.

How to get DXF or KML from OpenStreetMap

osm2cdr builds DXF and KML directly from OpenStreetMap data — there is no need to download raw OSM extracts or install conversion tools. The steps:

  1. Open the osm2cdr map for DXF and find your place by name, or draw a rectangle around the area.
  2. Choose DXF or KML in the format list and set the options offered for it, such as map layers, style or sheet size.
  3. Start the export and download the result: DXF arrives as a .dxf file, or a ZIP with the .dxf and a .prj when you pick a coordinate system yourself; KML arrives as a .kml file.
  4. Need KML as well as DXF? Run a second export of the same area. Both start from the same OpenStreetMap data, but each keeps only what its format can hold, as described in the sections on DXF and KML above.

Converter pages related to DXF and KML explain each route in more detail:

Frequently asked questions

What is the main difference between DXF and KML?

DXF is an openly documented CAD drawing exchange format, whereas KML is an XML format for showing geographic data on a virtual globe. In the comparison table, DXF is ahead on CAD compatibility and true scale 1:1; KML is ahead on google Earth and visual styling.

Which is better for CAD compatibility, DXF or KML?

DXF. Reach is its main strength: when you do not know which program the recipient uses, DXF is the safest bet.

When does KML beat DXF?

When google Earth and visual styling matter most. KML is built for presentation: a client can explore the data on a globe without GIS skills, click a feature to see its attributes and switch folders on and off.

Can I convert DXF to KML?

Yes. osm2cdr has a dedicated DXF to KML converter page for existing files. If you are starting from OpenStreetMap, export the area straight to KML instead.

Which programs open DXF and KML files?

DXF files open in AutoCAD, BricsCAD, NanoCAD, KOMPAS-3D, FreeCAD, LibreCAD and QGIS. KML files open in Google Earth, Google My Maps, QGIS, ArcGIS and Global Mapper.

Do DXF and KML keep real-world coordinates?

DXF can carry its coordinate system: osm2cdr writes a GEODATA object into the drawing and by default uses metres in the UTM zone of the area or a national grid; if you pick a system explicitly, a .prj file comes with the drawing in a ZIP. KML always uses WGS 84 longitude, latitude and optional altitude, so features land in the right place in Google Earth without any setup.

Export to DXF Export to KML