Cadastral to Vector
Convert cadastral map PNGs to vector polygon feature classes usable for property registration. Pipeline: OCR extracts boundary point coordinate table → automatic detection of CGCS2000 3-degree zone number and coordinate axes → ordered points form closed polygons → write to FileGDB/Shapefile, with on-map area used for self-check.
When to Use
- Cadastral map / parcel map (PNG/JPG) → GDB or Shapefile polygon feature class
- Existing boundary point coordinate table text → polygon feature class
- Need to determine CGCS2000 Gaussian projection zone number (EPSG)
- Property registration-grade accuracy (coordinates precise, topology closed)
Workflow
- Confirm Input: Cadastral map PNG (primary) or coordinate table text/CSV (fallback). Ask whether property registration-grade precision is required.
- OCR Coordinates + Attributes:
- First choice: use
analyze_imageMCP (multimodal, most accurate). Prompt to extract coordinate table + attributes (rightful owner / parcel number / area / use / adjacent boundaries) digit by digit exactly. Mark unclear items as "unclear"—do not guess. - If no MCP, run
scripts/ocr_coords.py --method auto(paddleocr→tesseract). - If neither works, ask the user to manually transcribe.
- First choice: use
- Present Coordinate Table for User Review: All OCR results must be shown to the user for individual verification (property-grade data cannot be blindly trusted). Save verified coordinates as
pts.txt(one line per row:point_id, coord_A, coord_B, in boundary connection order). - Automatic Zone/Axis/CRS Detection: Run
scripts/coords_to_feature.py --coords pts.txt --source <image> --detect-only, or follow the rules:- Column with a zone prefix (8-digit number, first 2 digits between 25-45) = easting; the other column = northing.
- Zone N → EPSG = 4488 + N, central meridian = 3N.
- Neither column has a prefix → ask the user for zone number + axis order.
- Detection Results Must Be Confirmed by User (mandatory step): Show zone number / central meridian / EPSG / easting column / northing column. Proceed only after user confirmation.
- Attribute Fields: Ask the user if they want business fields (rightful owner / parcel number / area etc., checked from OCR results);
source_filefield is added automatically (records the source file path for traceability). - Write GDB/Shapefile: Run
scripts/coords_to_feature.py --out xxx.gdb --fig-area <on_map_area> [--attrs-json ...]. arcpy preferred; fallback to GDAL if arcpy unavailable; fallback to Shapefile if GDB cannot be written. - Self-Check + Delivery: Check the script's output for area self-check (PASS/FAIL); if FAIL, review coordinates. Deliver
.gdb/.shp, note the attribute table includessource_file.
Dependencies
- Python 3
- Write GDB: arcpy (ArcGIS Pro with arcgispro-py3) or GDAL/osgeo ≥3.6 (OpenFileGDB driver can create)
- OCR: analyze_image MCP (preferred) / paddleocr / tesseract(chi_sim) / manual transcription
Scripts
scripts/coords_to_feature.py— coordinate table → GDB/shp polygon feature class (auto detection + arcpy/GDAL fallback + source_file + area self-check)scripts/ocr_coords.py— PNG → coordinate table + attributes (paddleocr/tesseract fallback chain)
Notes
- Property Registration Grade: A single wrong coordinate is a critical error. All OCR/auto-detection results must be user-verified.
- Area Self-Check: Calculated area vs. on-map area. Warn if error > 0.5%. Swapped axes leave area unchanged—self-check cannot catch this; rely on step 5 (manual axis confirmation).
- Multiple Parcels: Currently supports single parcel (one map, one polygon); multi-parcel support is future work.
- Shapefile field names are limited to 10 bytes; Chinese business field names will be truncated. Recommend GDB or English field names.