Skip to main content
Loading navigation
Back to prompt library

Build a CityJSON Land Use and Bounding Setback Auditor — implementation

Linked challenge: Build a CityJSON Land Use and Bounding Setback Auditor

Prompt source

implementation97 lines11 sectionsNo variables1 code block
## Build
Parse CityJSON 2.0 LandUse and Building objects to evaluate parcel boundary compliance. Compute structural setbacks from geographicalExtent coordinates to flag municipal zoning buffer infringements.

## User
Municipal Zoning Officer

## Workflow
1. Ingest CityJSON 2.0 files containing LandUse parcels and Building footprint geometries.
2. Extract 2D bounding polygon coordinates from geographicalExtent and surface boundary indices.
3. Calculate minimum Euclidean distance between building footprint edges and parcel boundary lines.
4. Generate a structured zoning infraction docket highlighting non-compliant setback violations.

## Interface
Zoning review console displaying parcel boundary overlays, calculated setbacks, and infraction callouts.

## Data
Use open municipal 3D city models formatted in CityJSON 2.0 or generate synthetic parcel/building pairs.
Starter examples below are synthetic. They are not downloaded records.

## Source
[CityJSON](https://www.cityjson.org/specs/2.0.1/)
Extracts LandUse objects, Building objects, and geographicalExtent bounding arrays from CityJSON 2.0 Section 2.

## Tools
pydantic-ai, shapely, FastAPI.
Pydantic AI guarantees strictly validated infraction reports and typed geometric distance records.
Fast instruction model capable of interpreting municipal zoning codes against geometric coordinates.

## 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
- Parses LandUse and Building CityObjects from standard CityJSON 2.0 payloads.
- Computes horizontal setbacks between building perimeters and parcel boundaries.
- Flags structures violating minimum required municipal setback thresholds.

## Starter Examples
```json
[
  {
    "input": {
      "parcel_id": "PARCEL-401",
      "parcel_extent": [
        0,
        0,
        0,
        50,
        50,
        0
      ],
      "building_id": "BLDG-401",
      "building_extent": [
        6,
        6,
        0,
        30,
        30,
        15
      ],
      "required_min_setback_meters": 5
    },
    "expected_output": {
      "parcel_id": "PARCEL-401",
      "building_id": "BLDG-401",
      "computed_min_setback_meters": 6,
      "zoning_compliant": true,
      "infractions": []
    }
  },
  {
    "input": {
      "parcel_id": "PARCEL-402",
      "parcel_extent": [
        0,
        0,
        0,
        40,
        40,
        0
      ],
      "building_id": "BLDG-402",
      "building_extent": [
        2,
        5,
        0,
        35,
        35,
        12
      ],
      "required_min_setback_meters": 5
    },
    "expected_output": {
      "parcel_id": "PARCEL-402",
      "building_id": "BLDG-402",
      "computed_min_setback_meters": 2,
      "zoning_compliant": false,
      "infractions": [
        "Western setback of 2.0m violates minimum required setback of 5.0m by 3.0m"
      ]
    }
  }
]
```

## Safety
Automated checks serve as preliminary screening; final zoning permits require certified land surveyor sign-off.
Use mock external writes. Require human review before any real deployment.