★ New · feat/cad-import

CAD drawings, on the map

Bring engineering and site plans in their native CAD formats onto the map, georeference them with control points or a source CRS, and serve the result as GeoJSON, MBTiles vector tiles, or GeoPackage — rendered alongside your basemaps and 3D scene layers.

DWGDXFDGN EPSG:4326EPSG:3857MBTiles-vectoraffine · polynomial-2
What it reads

Three CAD formats, three outputs

DXF is read in-process via the managed OGR driver (always available). DWG and DGN fall back to external ogr2ogr with the OpenDesign / ODA driver — the response carries a driver field so the UI can tell you when a portable GDAL is needed.

  • Outputs served as layers: GeoJSON (GeoJSONLayer), MBTiles vector tiles (VectorTileLayer), and GPKG (FeatureLayer).
  • All output geometry normalized to EPSG:4326 (WGS84); the MBTiles path additionally reprojects 4326 → 3857 during tiling.
  • Files written in-process for DXF/GPKG — no external GDAL required for the common case.
POST /api/cad/convert (multipart)
// DWG/DXF/DGN → georeferenced layer
fields:
  file        = site-plan.dwg
  format      = mbtiles-vector
  georefMode  = controlPoints
  controlPoints = [
    {src:[0,0],   wgs84:[-74.00,40.71]},
    {src:[500,0], wgs84:[-73.99,40.71]},
    {src:[0,500], wgs84:[-74.00,40.72]}
  ]
  transformKind = affine   // or polynomial-2

→ driver:"ogr2OgrFallback"
→ served at /api/tiles/{id}/…
Two ways to georeference

From local CAD coords to real-world positions

CAD lives in arbitrary drawing units. 3D Map Explorer gives you two robust paths onto the globe, both with a live RMSE preview before you commit.

🎯

Control points

Click ≥3 matching points between the drawing and the map. A least-squares affine (6-param) or polynomial-2 (12-param) transform is solved with RMSE reported — so you see the fit before importing.

🌐

Source EPSG

If the plan already carries a real projected CRS (e.g. a UTM zone), supply it directly. OSR reprojects to WGS84 with no manual clicking.

The conversion API

Convert, preview, serve

CapabilityEndpointNotes
PreviewPOST /api/cad/previewBounds, layers & GeoJSON in source coords
ConvertPOST /api/cad/convertMultipart → GeoJSON / MBTiles-vector / GPKG
FeaturesGET /api/cad/{id}/features.jsonTransformed GeoJSON, ETag / 304 cached
TilesGET /api/tiles/{id}/{z}/{x}/{y}MBTiles-vector rendering
StyleGET /api/tiles/{id}/style.jsonVector tile style
Spatial facades/api/spatial/cad_{id}/…MVT / OGC Features / FeatureServer
RemoveDELETE /api/cad/{id}Removes from registry + deletes files

Source: CAD_IMPORT.md and Src/LocalMapServer/Cad/ (CadReader, CadGeoreferencer, CadConverter, CadRoutes). Affine/polynomial math via least-squares; reprojection via GDAL/OSR.

Engineering plans meet the real world

Overlay DWG/DXF/DGN site plans on imagery and 3D terrain — georeferenced, tiled, and served from the desktop.