Communitygithub.com

edcfoshan/cadastral-to-vector

宗地图/地籍图(PNG)转矢量面要素类(FileGDB/Shapefile)。CGCS2000 3度带带号+坐标轴自动判定,OCR提取界址点坐标,arcpy/GDAL双后端,面积闭环自检。宗地图矢量化|界址点坐标表转GDB|高斯投影带号判定|权属登记。Cadastral map to vector, parcel to FileGDB/Shapefile, CGCS2000 zone detection, Python.

cadastral-to-vector 是什么?

cadastral-to-vector is a Claude Code agent skill that 宗地图/地籍图(PNG)转矢量面要素类(FileGDB/Shapefile)。CGCS2000 3度带带号+坐标轴自动判定,OCR提取界址点坐标,arcpy/GDAL双后端,面积闭环自检。宗地图矢量化|界址点坐标表转GDB|高斯投影带号判定|权属登记。Cadastral map to vector, parcel to FileGDB/Shapefile, CGCS2000 zone detection, Python.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add edcfoshan/cadastral-to-vector

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

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

  1. Confirm Input: Cadastral map PNG (primary) or coordinate table text/CSV (fallback). Ask whether property registration-grade precision is required.
  2. OCR Coordinates + Attributes:
    • First choice: use analyze_image MCP (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.
  3. 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).
  4. 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.
  5. Detection Results Must Be Confirmed by User (mandatory step): Show zone number / central meridian / EPSG / easting column / northing column. Proceed only after user confirmation.
  6. Attribute Fields: Ask the user if they want business fields (rightful owner / parcel number / area etc., checked from OCR results); source_file field is added automatically (records the source file path for traceability).
  7. 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.
  8. 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 includes source_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.

相关技能