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>
37 lines
1.7 KiB
Markdown
37 lines
1.7 KiB
Markdown
# ML segmentation server for MAPS-to-DXF
|
|
|
|
Run this server to enable **Use server-side ML segmentation** in the app. It traces buildings, trees, and lots from satellite imagery.
|
|
|
|
## Run
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
python segment_server.py
|
|
```
|
|
|
|
Or double-click **Start_ML_Server.bat** from the project root.
|
|
|
|
Server listens on **http://127.0.0.1:3457**. The Node app proxies `/api/segment` to it.
|
|
|
|
## Backends
|
|
|
|
**Default: OpenCV** (Canny + contours)
|
|
|
|
- **Canny** edge detection (50, 150) on blurred, contrast-stretched grayscale.
|
|
- **RETR_EXTERNAL** so only outer contours are used.
|
|
Ref: [jydhasan/google_map_trace](https://github.com/jydhasan/google_map_trace).
|
|
- **approxPolyDP** with epsilon = 1% of contour perimeter.
|
|
- Classification by area/compactness; contours < 15 m² skipped.
|
|
|
|
**Optional: Threshold mode (map-style)** (enable “Threshold mode (map-style)” in the app)
|
|
|
|
- Inspired by [NYPL map-vectorizer](https://github.com/nypl-spacetime/map-vectorizer): brightness + contrast then threshold to get a binary image (dark = features, light = background), then contours.
|
|
- Good for line-drawing imagery or high-contrast maps (e.g. scanned plans). Same contour classification as the default path.
|
|
- Optional form params: `brightness` (default 0), `contrast` (default 1.0), `thresholdBlack` (default 160), `thresholdWhite` (default 255). Dark pixels below `thresholdBlack` become foreground.
|
|
|
|
**Optional: VTracer** (enable “Use VTracer (cleaner vectors)” in the app, or set `USE_VTRACER=1`)
|
|
|
|
- [visioncortex VTracer](https://github.com/visioncortex/vtracer): raster → SVG, O(n), compact output.
|
|
- `pip install vtracer` in this folder, then use the checkbox or env var.
|
|
- Uses binary/line-art mode and filter_speckle for cleaner building outlines.
|