GEOO.APPGEOO.APP
Back to all posts
2026-11-0619 min readDWGGISGeoJSONKMLShapefileCADLibreDWGcoordinate system

DWG to GIS: GeoJSON, KML, or Shapefile — and the trap that sinks your data

A practical guide to turning AutoCAD DWG into GIS-ready GeoJSON, KML and Shapefile. Built around a real 190 KB survey drawing, covering the coordinate-system trap, a fully browser-based conversion, output sizes, and how to pick a format.

You have probably lived this scene: someone drops harbour-747-boundary.dwg in your inbox and says "just make me a shapefile." You open it in QGIS, import, and get either a blank canvas or a line sitting in the Gulf of Guinea, off the coast of Africa. The DWG in the folder is clearly fine — so why does it fall apart the moment it touches GIS?

It is not you. It is the format. A DWG is the most common vector drawing format on earth and the least welcome one in any geographic information system. Every civil, survey, utility, and architecture project ships its deliverables as AutoCAD DWG, yet QGIS, Google Earth, and virtually every web map expect GeoJSON, KML, or Shapefile. The gap between those two worlds is where a lot of perfectly good field data goes to die.

This article is the bridge across that gap. I will say what a DWG actually contains, explain why a naive "convert DWG to GeoJSON" drops you straight into a coordinate-system trap, and then walk a real 190 KB drawing through a browser-based conversion from start to finish. You do not need to care whether the numbers are "measured" — just follow along and your boundary will not end up in the ocean.

DWG to GIS at a glance

Figure 1. One DWG, three GIS exports, all produced client-side with no upload.

1. First, the thing you are actually dealing with

A DWG is the native binary format of Autodesk AutoCAD. It is a closed, versioned container that stores drawing entities — lines, polylines, arcs, circles, text, blocks, layers, linetypes, and a great deal of metadata — in a proprietary binary layout that changes with almost every AutoCAD release. GIS libraries do not read it, and each of the three reasons predicts a different kind of failure:

So when someone emails you harbour-747-boundary.dwg and asks for a shapefile, the real task is not "convert a format" — it is "reverse-engineer a drawing into geographic features, and get the coordinate reference system right." Everything else is detail.

1.1 Which DWG entities convert cleanly?

Not all DWG geometry is created equal. The table below summarises, from experience, how common entity types behave when you push them through a DWG→GeoJSON→GIS pipeline:

DWG entitySurvives conversion?What it becomes
LINEYesa 2-vertex LineString (or two Points)
LWPOLYLINE / POLYLINEYesa LineString; closed polylines are still lines, not polygons, unless you close them
ARC / CIRCLEWith tessellationan approximated LineString of short segments
SPLINEWith tessellationan approximated LineString
POINT / POINT blocksYesa Point
INSERT (block reference)Often flattenedthe block's geometry inlined, or dropped
3DFACE / MESH / solidsRarelyusually skipped by 2D converters

The practical takeaway: 2D vector linework converts well; 3D, splines, and complex blocks are where you lose fidelity. Validate the output against the original before you publish it.

2. The coordinate-system trap

This is the part that bites everyone, and it is the reason a correct-looking conversion can land your data in the middle of the ocean. It deserves more than a paragraph.

CAD files almost never use WGS84 longitude/latitude. They use a local or national projected grid — UTM, a state plane zone, a survey grid with a large false easting, or simply "metres from an arbitrary origin" chosen by the surveyor. The numbers are big. When I ran the real harbour-boundary DWG through the converter, the first three vertices of the resulting line were:

[38490267.439, 3834741.192300005]
[38490268.4753, 3834741.1510000005]
[38490278.5824, 3834741.9421000015]

Those are not coordinates you can paste into Google Maps. A longitude of 38,490,267 is physically impossible — longitude only ranges from -180 to 180. They are metres in some engineering coordinate system — exactly the kind of value a surveyor's total station or a national grid produces. The first number (38,490,267) is an easting with a large false easting baked in; the second (3,834,741) is a northing. Neither is degrees.

The coordinate-system trap

Figure 2. CAD numbers are a projected grid in metres. Web maps need WGS84 degrees. You must assign the source CRS and reproject.

2.1 Why false easting matters

A "false easting" is a constant added to every easting coordinate so that values stay positive within a zone. UTM, for example, adds 500,000 m to the easting of every point so that nothing goes negative. National grids add even larger values. That is why a perfectly valid UTM coordinate can read 38,490,267 instead of something near 500,000. The magnitude is a clue, not a bug: tens of millions with a few-million companion almost always means "metres, large false easting."

2.2 What happens if you ignore it

If you export that GeoJSON and open it in QGIS without telling QGIS what the numbers mean, QGIS will happily treat them as if they were lon/lat and draw your harbour boundary at (0, 0) — off the coast of Africa, in the Gulf of Guinea, the classic "my data is broken" location. The geometry is correct; the interpretation is wrong. The fix is not another conversion; it is defining the source CRS and reprojecting to EPSG:4326.

2.3 The two rules that save you

  1. Find the CRS before you convert. The DWG usually arrives with a companion .prj (if it was ever exported to shapefile), a survey report, or a note like "GK zone 40" or "UTM 50N" or "State Plane 32001." If you have it, great. If you do not, ask the data supplier — guessing a CRS is how projects ship misplaced boundaries.
  2. Tag it, then reproject. Keep the raw CAD coordinates, attach the correct EPSG code, and only then transform to WGS84 for web use. Tagging first means you can always recover; reprojecting blind means you cannot.

3. A client-side path: no install, no upload

Most DWG-to-GIS advice tells you to install AutoCAD, export to DXF, then run ogr2ogr, or to upload your file to a server you have never heard of. There is a cleaner path that runs entirely on the client.

How the conversion works

Figure 3. The geoo.app pipeline: LibreDWG parses the binary DWG to GeoJSON, then GDAL repackages it to KML or a zipped Shapefile.

The pipeline has two stages, both compiled to WebAssembly so they execute in the browser:

The practical consequence is significant for sensitive work: your file never leaves your machine. There is no upload, no account, no server round-trip. For survey data that may be commercially or security sensitive, that matters far more than the format you pick.

3.1 How this compares to the desktop route

RouteNeeds install?File leaves machine?Best for
Browser (LibreDWG + GDAL WASM)NoNoquick, private, one-off conversions
ogr2ogr + AutoCAD/DXFYes (AutoCAD often)Noscripting, batch, CI pipelines
Online upload serviceNoYesconvenience at the cost of privacy

4. How big will the output be? (one real 190 KB DWG)

I converted the same real harbour-boundary drawing — a 190,039-byte DWG containing a single closed boundary — to all three target formats and recorded the exact output sizes.

SourceFormatOutput sizeGeometry
harbour-747-boundary.dwg (190 KB)GeoJSON1,099,732 B (1.05 MB)1 LineString, 13,353 vertices
harbour-747-boundary.dwg (190 KB)KML304,850 B (298 KB)1 Placemark (LineString)
harbour-747-boundary.dwg (190 KB)Shapefile (.zip)142,716 B (139 KB)1 feature, 1 .shp

Output size per format

Figure 4. Exact byte counts for one DWG exported three ways. GeoJSON is largest; binary Shapefile is smallest.

Three things are worth calling out, because they surprise people:

All three carry the identical 13,353-vertex line. The size difference is purely encoding, not geometry. If you are shipping over a slow link, Shapefile wins; if you are feeding a JavaScript map, GeoJSON is worth the size.

5. Two routes to convert

You have two routes. Pick the one that fits your constraints.

Route A — in the browser (no install, no upload)

Open the DWG to GeoJSON, DWG to KML, or DWG to Shapefile tool, drop your .dwg, and click Convert. The result appears as a download; the interface shows the uploaded file, the source/target selectors, and the converted output.

The converter in action

Figure 5. The geoo.app converter with the real DWG loaded and ready to convert.

After conversion you get a download button for the finished file:

The conversion result

Figure 6. The converted output, ready to download — produced entirely in the browser.

If you know the source CRS, set it in the Coordinate System control before exporting; if you leave it on "inferred", you will reproject afterwards (Section 6).

Route B — the classic ogr2ogr workflow (desktop)

If you prefer a command line and you already have GDAL, the mental model is the same, just split across tools. Note that open GDAL reads DXF natively but needs a commercial DWG driver for DWG; the open path is to first get a DXF (AutoCAD "Save As DXF", or via LibreDWG's dwg2dxf), then:

# DXF -> GeoJSON
ogr2ogr -f GeoJSON boundary.geojson boundary.dxf

# Inspect what GDAL thought the layer was
ogrinfo boundary.dxf

For a DWG you obtained as DXF, or once you have a GeoJSON from the browser tool, the reprojection step is identical (next section).

6. Reprojecting to WGS84: the step you cannot skip

Whether your GeoJSON came from the browser tool or ogr2ogr, if the coordinates are in a projected grid you must reproject before they make sense on a web map. Here is the ogr2ogr incantation, using a hypothetical source CRS of EPSG:4549 (a common CGCS2000 / Gauss-Krüger zone) as an example — replace it with the real EPSG of your drawing:

# Reproject a projected GeoJSON to WGS84 lon/lat
ogr2ogr -f GeoJSON -s_srs EPSG:4549 -t_srs EPSG:4326 \
  boundary_wgs84.geojson boundary.geojson

After this, the first vertex that was [38490267.439, 3834741.192] becomes something like [121.49, 31.23] — a real longitude/latitude you can drop into QGIS, Leaflet, or Google Earth. Notice the order does not change (both GDAL and GeoJSON use lon/lat); only the values change.

If you do not know the EPSG, three places to look:

A faster route, if you already have the file in the browser, is to set the source CRS in the converter's Coordinate System control and let it emit WGS84 directly — no second step required.

7. Which format should you actually ship?

Use caseFormatWhy
Web maps, Leaflet/Mapbox, APIsGeoJSONNative to JavaScript, RFC 7946 standard, trivial to fetch and style
Google Earth, sharing with non-GIS usersKMLEarth and most viewers open it with a double-click
ArcGIS, QGIS, desktop analysisShapefileStill the lingua franca of desktop GIS
Storing the raw line with attributesanyThe geometry is identical; pick by destination

A useful rule: convert to GeoJSON as your canonical intermediate (it is the easiest to inspect, reproject, and edit), then derive KML or Shapefile from that GeoJSON when a specific tool demands it. You avoid re-running the DWG parse every time.

7.1 A worked scenario: one drawing, three deliverables

To make the format choice concrete, imagine the harbour-747-boundary.dwg lands in your inbox and three different teams need it. The web team wants to draw the boundary on a public Leaflet map, so they take the GeoJSON (reprojected to EPSG:4326) and fetch it as JSON — no desktop GIS required. The project manager wants to show a client the boundary in Google Earth during a meeting, so they take the KML, which opens with a double-click and needs no software licence. The GIS analyst wants to clip the boundary against a cadastral layer in QGIS, so they take the Shapefile, the format QGIS handles natively with its .dbf attributes intact. All three came from the same 13,353-vertex line; only the packaging differed. The mistake people make is converting the DWG three separate times, once per destination, which means three chances to get the CRS wrong. Convert once to GeoJSON, reproject once, then derive the rest — your reprojection is applied in exactly one place and stays consistent everywhere.

8. Before you publish: a self-check

8.1 A short quality checklist before you publish

  1. Open the output in QGIS next to the original DWG. Do the lines overlap?
  2. Check the coordinate range. Are you seeing values near (0,0) or in the tens of millions? If so, the CRS is still wrong.
  3. Confirm the geometry type you expected (was the boundary a line or should it have been a polygon?).
  4. Spot-check three vertices in both files. They should match after you account for the CRS transform.
  5. If attributes matter, open the .dbf / GeoJSON properties and confirm what survived.

9. Frequently asked questions

Can I convert DWG to GeoJSON for free? Yes. The browser path above is free and requires no software. The ogr2ogr path is free and open-source if you have a DXF or a GDAL build with a DWG driver.

Why is my converted DWG in the wrong place? Almost certainly the coordinate system. See Sections 2 and 6.

Is my file uploaded to a server? On geoo.app, no — the conversion runs in your browser via WebAssembly.

DWG or DXF — which should I start from? DXF is the open, text-based sibling of DWG and is easier for desktop tools. If you already have the DWG and a browser, convert it directly; if you are scripting, prefer DXF.

Will I keep my layers? Layer names are typically preserved as a property; deeper CAD structure is not.

Why is the GeoJSON so much bigger than the DWG? Because the DWG is binary and compressed while GeoJSON spells out every coordinate as text. They carry the same line.

Can I convert just one layer of a DWG? Not in a single click; you would typically convert the whole drawing and then select features by layer in QGIS.

Does this work for DGN or MicroStation files? Those are a different format; convert them to DWG/DXF first, or use a DGN-aware GDAL driver.

10. Recap

A DWG is a CAD drawing, not a map. To turn it into GIS data you need three things: a parser that reads the binary (LibreDWG), a writer that emits OGC formats (GDAL), and — most importantly — the correct source coordinate system. Skip the last one and your data lands at (0, 0), looking correct in every way except the one that matters. Get the CRS right and the rest is bookkeeping.

On the 190 KB harbour-boundary drawing used here, the browser pipeline produced a 1.05 MB GeoJSON, a 298 KB KML, and a 139 KB Shapefile, all carrying the same 13,353-vertex line. Start from GeoJSON, reproject to EPSG:4326, and derive the rest as needed.

If you want the companion piece on getting out of a GPS device, the GPX file guide covers tracks, routes, and waypoints. And if you are deciding between container formats in general, the KML vs KMZ and DWG vs DXF comparison measures those trade-offs directly.


About the data: every byte count, coordinate, and file size in this article comes from running a real 190,039-byte harbour-boundary DWG through geoo.app — no estimates, no rounding. The code and samples are in the sections above.