Skip to main content

Survey Maps Module

The survey maps module handles the ingestion and processing of surveyor DWG files — the starting point for every Xylem project.

Processing Pipeline

Upload DWG


┌─────────────────────────────┐
│ 1. DWG → DXF Conversion │ (ODAFileConverter or LibreDWG)
│ via xvfb-run (headless) │
└─────────────┬───────────────┘


┌─────────────────────────────┐
│ 2. DXF → GeoJSON │ (ogr2ogr from GDAL)
│ Extracts site boundary │
└─────────────┬───────────────┘


┌─────────────────────────────┐
│ 3. AI Metadata Extraction │ (Google Gemini)
│ - Site area │
│ - Owner name │
│ - Survey number │
│ - Dimensions │
└─────────────┬───────────────┘


┌─────────────────────────────┐
│ 4. Geocoding │ (Google Maps API)
│ Address → lat/lon │
└─────────────┬───────────────┘


┌─────────────────────────────┐
│ 5. Zone Analysis │ (GDAL + GeoTIFF)
│ AAI Color Zone check │
│ Authority detection │
└─────────────┬───────────────┘


SurveyMap record saved
(with all file references)

Endpoints

MethodPathDescription
POST/survey-maps/uploadUpload a DWG file
GET/survey-maps/:idGet survey map details and metadata
GET/survey-maps/:id/geojsonGet the converted GeoJSON
GET/survey-maps/:id/pdfGet the converted PDF

Key Utilities

FilePurpose
dwgReader.tsDWG → DXF/JSON conversion using LibreDWG CLI
dxfToGeojson.tsDXF → GeoJSON conversion using ogr2ogr
geocodeAddress.tsGoogle Geocoding API wrapper
getSiteElevation.tsOpen-Meteo elevation API
getAuthority.tsPoint-in-polygon authority detection using authorities.geojson
zoneChecker.tsGDAL-based zone analysis using the AAI Color Zone Map GeoTIFF

Zone Analysis

The zone checker clips the AAI Color-Zone Map GeoTIFF to the site boundary and analyzes pixel colors to determine:

  • Which color zone the site falls in (e.g., Yellow, Blue, Red)
  • The corresponding height restrictions for that zone
  • Uses gdalwarp for clipping and gdal2xyz.py for pixel extraction

Road Width Detection

For sites in Bangalore, the system checks the BDA CDP 2015 road network data (blr_roadWidth.geojson) to determine the abutting road width, which affects FAR and setback calculations.