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
| Method | Path | Description |
|---|---|---|
POST | /survey-maps/upload | Upload a DWG file |
GET | /survey-maps/:id | Get survey map details and metadata |
GET | /survey-maps/:id/geojson | Get the converted GeoJSON |
GET | /survey-maps/:id/pdf | Get the converted PDF |
Key Utilities
| File | Purpose |
|---|---|
dwgReader.ts | DWG → DXF/JSON conversion using LibreDWG CLI |
dxfToGeojson.ts | DXF → GeoJSON conversion using ogr2ogr |
geocodeAddress.ts | Google Geocoding API wrapper |
getSiteElevation.ts | Open-Meteo elevation API |
getAuthority.ts | Point-in-polygon authority detection using authorities.geojson |
zoneChecker.ts | GDAL-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
gdalwarpfor clipping andgdal2xyz.pyfor 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.