Files
MAPS-to-DXF-standalone/ml_server/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

1.8 KiB

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

Double-click Start.bat in the project root (starts the main app and this ML server together).

Or from a terminal:

pip install -r requirements.txt
python segment_server.py

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.
  • 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: 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: 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.