Files
MAPS-to-DXF-standalone/README.md
T
Michael-A-SloanandCursor 7769a4412e feat: harden maps export for CAD and improve satellite/OSM workflow
Cap zoom to real imagery, attach a BricsCAD-safe DXF IMAGE at the selected extent, and consolidate startup plus Overpass/address handling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-31 15:43:01 -04:00

98 lines
4.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# MAPS to DXF — Standalone GUI
Turn a **Google Maps link** into a **DXF map** with roads, rails, buildings, and **lot boundaries**. No Google Sheets. Run locally, export to your computer.
---
## Requirements
- **Node.js** (v18 or newer) — for the local server and Overpass/satellite proxy
---
## How to run
**Easiest:** Double-click **Start.bat**.
- If Node.js isn’t installed, the script will try to install it (Windows Package Manager) or open the Node.js download page. After installing, run **Start.bat** again.
- If Node.js is installed: the app starts in **one window**, your browser opens, and the optional Python ML server starts in the background if Python is installed. Keep the console window open while using it; close it to stop everything.
**Or from a terminal:**
```bash
cd MAPS-to-DXF-standalone
npm install # first time only
npm start
```
Then open **http://localhost:3456** in your browser.
---
## Workflow
1. **Paste** a Google Maps URL that contains coordinates (e.g. `https://www.google.com/maps/@40.7128,-74.0060,...`).
2. **Load preview** — fetches OpenStreetMap data and draws roads, rails, buildings, water, parks.
3. **Show satellite imagery** — optional; useful for aligning lot boundaries.
4. **Add lots** (choose one or combine):
- **Select detection area** → drag a rectangle → **Add selection as lot** — use the blue box as one property lot (building + parking).
- **Select detection area** → **Detect lots from imagery** — auto-detect inside the rectangle (smaller lots ~80 m²).
- **Detect lots from imagery** (no selection) — auto-detect over the full view (often finds building outlines).
- **Draw lot** — click to add vertices, double-click or **Close lot** to finish one polygon.
5. **Edit lots** — drag lot corners to correct positions.
6. **Export DXF** — downloads the DXF and (if satellite was used) a PNG; keep both in the same folder for CAD.
---
## Port
Default port is **3456**. To use another:
```bash
PORT=8080 npm start
```
Then open http://localhost:8080
---
## Why a local server?
- **Overpass API** (OpenStreetMap) blocks direct browser requests (CORS). The Node server proxies Overpass and satellite tile requests.
- DXF and PNG are generated in the browser and downloaded to your machine; nothing is stored on a remote server.
---
## Files
| File / folder | Role |
|--------------------|------|
| `Start.bat` | Only launcher you need: installs Node if needed, frees ports, starts the app + optional ML |
| `server.js` | Express server: serves `public/`, proxies Overpass and tile API |
| `public/index.html`| Single-page UI + canvas preview + all map/lot/edit logic (inline script) |
| `public/app.js` | Shared helpers: OSM→preview, DXF generation, OSM lot/concave-hull logic |
---
## Server-side ML and OSM-guided trace
- **Generate drawing from imagery** — Vectorizes satellite imagery into the DXF (client-side edge detection).
- **Use server-side ML segmentation** — Sends the imagery to a small Python server that runs OpenCV Canny + contours and classifies buildings, trees, and lots. Export writes separate DXF layers: **IMAGERY_BUILDINGS**, **IMAGERY_TREES**, **IMAGERY_LOTS**.
**To enable:** Double-click **Start.bat**. If Python is installed, the ML server starts automatically with the app (port 3457). If Python is missing, satellite tracing still works.
- **Snap imagery trace to OSM** — When enabled, trace points are snapped to nearby OSM buildings, roads, and landuse (within ~1.5 m). Use this to align the imagery trace with OSM where data exists.
---
## Going further: satellite imagery & ML
This app uses **OpenStreetMap** for vectors and optional **edge detection** (or server-side segmentation) on satellite imagery. For custom ML models and training data, see the satellite-image-deep-learning ecosystem:
- **[satellite-image-deep-learning/software](https://github.com/satellite-image-deep-learning/software)** — Curated list of software for satellite & aerial imagery ML: frameworks (TorchGeo, Raster Vision), **Label Maker** (pair OSM + satellite tiles for ML-ready data), image chipping/tiling, STAC, and QGIS plugins.
- **Label Maker** — Pairs satellite imagery with OpenStreetMap vector data to create training datasets; useful if you want to train or run models that segment buildings, roads, or land use.
- **Raster Vision, TorchGeo, segmentation tools** — For server-side or Python pipelines that segment imagery (buildings, trees, etc.) and export vectors; you can run these externally and import the resulting GeoJSON or DXF into your workflow.
- **Tile downloaders & COG tools** — The list includes MapTilesDownloader, sentinelsat, and Cloud Optimized GeoTIFF tools if you need different imagery sources or formats.
Run this app for quick OSM-based DXF + optional edge trace; use the [software list](https://github.com/satellite-image-deep-learning/software) when you need ML-based segmentation or custom training data.