All posts

Guide

DXF, GeoPackage or GeoJSON? Contour Lines for CAD and GIS

December 4, 2026 · By

DXF, GeoPackage or GeoJSON? Contour Lines for CAD and GIS

Short answer: DXF for CAD, GeoPackage for GIS, GeoJSON for the web. And whatever the format, pick a coordinate system in metres before you export. That one setting decides whether your contour lines land on the site plan or as a speck near the origin, far from everything else in the drawing.

This guide explains what each format is good at, which coordinate system to choose, and what is inside the files TopoLines writes, layer by layer and field by field. If you design posters or cut wood, you want SVG instead: contour map SVG covers that side.

The three formats at a glance

DXFGeoPackageGeoJSON
Made forCADGISWeb and scripts
Opens inAutoCAD, Civil 3D, Rhino, SketchUp Pro, QGISQGIS, ArcGIS Pro, GDALQGIS, Leaflet, Mapbox, D3, Python
ElevationZ on every vertexZ on every vertex, plus an elevation columnelevation property
Line typeOne layer per typetype columntype property
Coordinate system storedNoYesYes (legacy crs member)
One file, several layersYesYesNo, one collection

All three hold the same traced lines. The difference is how each program expects to read them.

DXF: for AutoCAD, Civil 3D, Rhino and SketchUp

DXF is the file every CAD program agrees on. TopoLines writes it as AutoCAD R12, the oldest and most widely read version. We tried a lighter hand-written DXF first: lenient readers opened it, strict ones refused it. R12 opens everywhere.

Each contour is a 3D polyline, with its elevation as the Z of every vertex. Orbit the view and the terrain stands up. Civil 3D can build a surface from it directly.

The line types sit on separate layers, so you can freeze or restyle each one:

  • CONTOUR_INDEX: the index contours, every Nth line as set in the editor (orange)
  • CONTOUR_INTERMEDIATE: the lines in between (grey)
  • CONTOUR_AUXILIARY: half-interval lines on flat ground, if you added them
  • COASTLINE: the sea edge, at Z = 0
  • RIVERS, CITIES, PEAKS, SUMMITS, POI and LABELS, if you added annotations
AutoCAD layer manager listing CONTOUR_INDEX, CONTOUR_INTERMEDIATE, CONTOUR_AUXILIARY, COASTLINE and annotation layers from a TopoLines DXF, with the 3D contours behind
A TopoLines DXF in AutoCAD: one layer per line type, the contours as 3D polylines.

What DXF can’t hold is an attribute table. The elevation lives in the Z value, the type in the layer name. That’s enough for CAD. In GIS it’s awkward, which is why GeoPackage exists.

Step-by-step pages for each program: AutoCAD and Civil 3D, SketchUp, Rhino and Grasshopper.

GeoPackage: for QGIS and ArcGIS Pro

GeoPackage is the OGC standard GIS file: a single file that holds several layers and stores its own coordinate system. Drop it into QGIS or ArcGIS Pro and it lands in the right place, with no prompt.

A TopoLines GeoPackage contains:

  • contours: 3D lines, with elevation (in metres), type (index, intermediate, auxiliary or coastline) and depression (1 when the line rings a hollow rather than a hill)
  • annotations: cities, peaks, summits and points of interest as points, with kind and name, when you added them
  • rivers: river lines with their name, when you added them
  • topolines_metadata: where the file comes from (elevation source and its credit, contour interval, coordinate system)

Because elevation is a real column, the usual GIS moves work right away: label lines with elevation, style them by type, filter out everything below 500 m, compute a length per band.

Need a Shapefile for an older workflow? In QGIS, right-click the contours layer, then Export › Save Features As. Or with GDAL:

ogr2ogr -f "ESRI Shapefile" contours.shp export.gpkg contours

The field names (elevation, type, depression) are 10 characters or fewer, so they survive the Shapefile limit intact.

GeoJSON: for the web and for code

GeoJSON is plain text. You can read it, diff it, load it in Leaflet, Mapbox GL or D3 with one line, or open it in Python with json. Each line carries its elevation and type as properties, and a metadata block at the top gives the source, interval and coordinate system.

One rule to know: the GeoJSON standard (RFC 7946) expects longitude and latitude in WGS 84. QGIS reads the legacy crs member that TopoLines writes, so a GeoJSON in Lambert-93 or UTM still lands in the right place there. Web libraries ignore it and assume lon/lat. For a web map, keep GeoJSON in WGS 84. For anything else, GeoPackage is the safer choice.

QGIS showing the same TopoLines export as DXF (index and intermediate layers) and as GeoJSON, with the GeoJSON attribute table listing elevation, type and depression
The same zone as DXF (left) and GeoJSON (right) in QGIS. The attribute table shows elevation and type on every line.

Pick the coordinate system before you export

This is where most imports go wrong. Every vector export in TopoLines has a Coordinate system setting:

OptionUnitUse it for
WGS 84, lon/lat (EPSG:4326)degreesWeb maps, GeoJSON, quick checks
RGF93 / Lambert-93 (EPSG:2154)metresMainland France
British National Grid (EPSG:27700)metresGreat Britain
WGS 84 / UTM, auto zonemetresAnywhere else
Web Mercator (EPSG:3857)“metres”Matching web tiles only

For CAD, never stay in lon/lat. The X and Y are then in degrees while Z is in metres. One degree of latitude is about 111 km, so in a 3D view the terrain becomes a needle, and every distance you measure is wrong.

UTM, auto zone picks the UTM zone under the centre of your area (for example WGS 84 / UTM zone 31N). It works anywhere on Earth, in metres, with little distortion across a site.

Avoid Web Mercator for measuring. Its units look like metres but grow with latitude: at 45° north, 100 m on the ground measures about 141 units. Use it only to line up with web map tiles.

If your project uses a national grid that isn’t in the list, export in UTM and reproject in QGIS or with ogr2ogr -t_srs. The coordinates are already in metres, so the step is clean.

What’s in the file, and what isn’t

In the file:

  • the contour lines of your zone, at the interval you chose (5 to 100 m)
  • the elevation on every line, and its type
  • annotations and rivers, if you added them in the editor
  • where the elevation comes from, and its credit

Coordinates are rounded to the millimetre in DXF, the centimetre in GeoJSON and GeoPackage, or about 10 cm in lon/lat. That’s far below the precision of the data.

Not in the file:

  • No styling. Colours, line weights and gradients belong to PNG and SVG. DXF layers get plain default colours, GIS formats none at all.
  • No elevation grid. You get the lines, not the DEM. To get a surface, build it from the contours (Civil 3D, Rhino and SketchUp all can).
  • No Points rendering. In Points mode, vector exports still contain the contour lines. The dots are a picture of the terrain, not data.

How accurate are the lines?

As accurate as the elevation data under them. In HD, TopoLines picks the best national model for your zone automatically, down to 1 m on small zones (0.5 m in Switzerland). Standard, and HD where no national model covers the zone, use the worldwide 30 m GEDTM30. The lines are smoothed and simplified, so they read like a map rather than a staircase.

That’s plenty for a site study, a concept design, a landscape plan or a 3D massing model. It is not a survey. For a building permit, earthworks or a legal boundary, hire a surveyor. Their points are what the contours should be checked against.

If you already have survey-grade elevation, upload your own GeoTIFF and trace it the same way: see DEM to contour lines.

How to export

  1. Open the contour map generator and draw your zone.
  2. Set the interval. How to choose a contour interval helps.
  3. Turn on index contours if you want the index type (and layer).
  4. In Export, pick DXF, GeoPackage or GeoJSON, then the Coordinate system.
  5. Download.

Vector exports are part of Pro and cost the same credits as any paid export, by area (up to 500 km² per zone). Details on the exports and plans page.

FAQ

Which format should I use for AutoCAD? DXF, in a coordinate system in metres: Lambert-93 in France, British National Grid in Great Britain, UTM anywhere else. Contours arrive as 3D polylines, one layer per type.

Can I get contour lines as a Shapefile? Export a GeoPackage, then save the contours layer as a Shapefile in QGIS (Export › Save Features As) or with ogr2ogr. The fields keep their names.

Why do my contour lines appear in the wrong place in CAD? Almost always the coordinate system. A file in WGS 84 lon/lat has X and Y in degrees, which CAD reads as tiny numbers near the origin. Export again in UTM or your national grid.

Do the files carry the elevation of each line? Yes, in all three. DXF stores it as the Z of each vertex. GeoPackage stores it as Z and as an elevation column. GeoJSON stores it as an elevation property.

Is a GeoJSON in UTM valid? Recent GeoJSON (RFC 7946) only allows WGS 84 lon/lat. TopoLines writes the older crs member so QGIS and GDAL still read a projected file correctly, but web libraries won’t. Keep GeoJSON in WGS 84 for the web, and use GeoPackage for projected data.

Can I import the contours into QGIS without any setup? Yes. GeoPackage stores its coordinate system, so it lands in place. Label with the elevation field and style by type. If you’d rather trace contours inside QGIS itself, see how to make contour lines in QGIS.

Draw your own
contour map.

Try TopoLines free