Skip to main content
Loading navigation
Back to prompt library

Build a Municipal Cadastral Boundary Encroachment Detector — implementation

Linked challenge: Build a Municipal Cadastral Boundary Encroachment Detector

Prompt source

implementation145 lines11 sectionsNo variables1 code block
## Build
Parse cadastral boundaries and building footprint extents from CityJSON objects. Identify unauthorized setbacks or property line encroachments to generate municipal zoning infraction notices.

## User
Municipal Land Records Auditor

## Workflow
1. Upload a municipal CityJSON parcel file containing Building and LandUse entities.
2. Calculate Euclidean distances between building boundary vertices and cadastral parcel edges.
3. Flag structural geometry exceeding legal zoning setback tolerances.
4. Generate an infraction report with spatial coordinates and parcel owner details.

## Interface
Cadastral map viewer displaying property boundary overlays, encroachment polygons, and zoning citation generation tools.

## Data
Use open cadastral 3D city data from municipal open-data portals formatted under CityJSON 2.0 specifications.
Starter examples below are synthetic. They are not downloaded records.

## Source
[CityJSON](https://www.cityjson.org/specs/2.0.1/)
Extracts geographicalExtent and attributes like owner and measuredHeight from Building and LandUse CityObjects.

## Tools
semantic-kernel, shapely, fastapi.
Semantic Kernel orchestrates procedural geospatial plugin calculations with LLM-generated municipal citation notices.
Hosted reasoning model supporting function calling to trigger boundary intersection checks and report generation.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Calculates minimum setback distance accurately across polygon boundaries.
- Correctly identifies encroachments within millimeter precision of transformed vertices.
- Formats zoning infraction notices containing parcel ID, owner, and distance breach.

## Starter Examples
```json
[
  {
    "input": {
      "parcel_id": "PARCEL-884-A",
      "zoning_rule": {
        "min_setback_meters": 3
      },
      "parcel_polygon": [
        [
          0,
          0
        ],
        [
          50,
          0
        ],
        [
          50,
          50
        ],
        [
          0,
          50
        ]
      ],
      "building_id": "BLDG-902",
      "building_footprint": [
        [
          1.5,
          5
        ],
        [
          25,
          5
        ],
        [
          25,
          25
        ],
        [
          1.5,
          25
        ]
      ],
      "owner": "Oakwood Properties"
    },
    "expected_output": {
      "parcel_id": "PARCEL-884-A",
      "building_id": "BLDG-902",
      "min_measured_setback_meters": 1.5,
      "setback_required_meters": 3,
      "encroachment_detected": true,
      "infraction_level": "Major",
      "notice_summary": "Building BLDG-902 breaches the western setback by 1.5 meters on parcel PARCEL-884-A."
    }
  },
  {
    "input": {
      "parcel_id": "PARCEL-102-B",
      "zoning_rule": {
        "min_setback_meters": 2.5
      },
      "parcel_polygon": [
        [
          0,
          0
        ],
        [
          30,
          0
        ],
        [
          30,
          30
        ],
        [
          0,
          30
        ]
      ],
      "building_id": "BLDG-105",
      "building_footprint": [
        [
          5,
          5
        ],
        [
          20,
          5
        ],
        [
          20,
          20
        ],
        [
          5,
          20
        ]
      ],
      "owner": "Jane Smith"
    },
    "expected_output": {
      "parcel_id": "PARCEL-102-B",
      "building_id": "BLDG-105",
      "min_measured_setback_meters": 5,
      "setback_required_meters": 2.5,
      "encroachment_detected": false,
      "infraction_level": "None",
      "notice_summary": "All building boundaries comply with minimum municipal setback limits."
    }
  }
]
```

## Safety
Municipal infraction notices are simulated drafts. Actual legal citations require survey confirmation and human clerk approval.
Use mock external writes. Require human review before any real deployment.