Node.js/Express server with web GUI for converting Google Maps links to DXF files. Includes optional Python ML server for satellite lot detection. Co-authored-by: Cursor <cursoragent@cursor.com>
104 lines
4.9 KiB
Markdown
104 lines
4.9 KiB
Markdown
# 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, your browser opens to the app. Keep the console window open while using it; close it to stop the server.
|
||
|
||
**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` | One-click run on Windows (installs Node if needed, then `npm start`) |
|
||
| `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:** In a second terminal:
|
||
```bash
|
||
cd ml_server
|
||
pip install -r requirements.txt
|
||
python segment_server.py
|
||
```
|
||
The Python server runs on **http://127.0.0.1:3457**. The Node app proxies `/api/segment` to it. If the Python server is not running, the checkbox will show an error when you use it.
|
||
|
||
- **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.
|