parcelform

Parcel and lot geometry metrics from GeoJSON polygons: shape indices, minimum-area rectangle, frontage and lot type, depth and width, setback envelopes and subdivision feasibility checks.

Version 0.1.2 · Python >=3.9 · MIT licence
pip install parcelform
PyPISourceIssuesChangelogCite (DOI)

parcelform

PyPI version Python versions pipeline status License: MIT DOI Downloads

Parcel and lot geometry metrics from GeoJSON polygons in projected coordinates.

parcelform measures cadastral parcels and building lots the way planners and land-use analysts usually need them: size and shape, how much of the lot faces a street, whether it is a corner, through or interior lot, how deep and wide it is, what is left after setbacks, and whether it can be split into lots that meet minimum standards. It needs only NumPy and reads and writes plain GeoJSON.

Installation

pip install parcelform

Requires Python 3.9 or newer and NumPy. Coordinates must be projected (metres or feet); the package does not reproject and refuses data that looks like longitude/latitude.

Quickstart

import parcelform as pf

lot = {"type": "Polygon",
       "coordinates": [[[0, 0], [20, 0], [20, 40], [0, 40], [0, 0]]]}
streets = [{"type": "LineString", "coordinates": [[-50, -4], [200, -4]]},   # main street
           {"type": "LineString", "coordinates": [[-4, -50], [-4, 100]]}]   # side street

pf.shape_indices(lot).polsby_popper          # 0.698
pf.min_area_rectangle(lot).to_dict()         # length 40, width 20, angle 90

fr = pf.frontage(lot, streets, tolerance=5, primary_rule="shortest")
fr.total, fr.lot_type                        # 60.0, 'corner'
pf.lot_dimensions(lot, fr)                   # depth 40, width 20, width/depth 0.5

env = pf.buildable_envelope(lot, {"front": 5, "side": 3, "rear": 4,
                                  "secondary_front": 3}, fr)
env.area, env.share                          # 434.0, 0.5425

rules = pf.LotRules(min_area=300, min_frontage=12, min_depth=20)   # from your zoning code
pf.check_lot(lot, rules, streets, tolerance=5).passed

wide = {"type": "Polygon",
        "coordinates": [[[0, 0], [60, 0], [60, 30], [0, 30], [0, 0]]]}
res = pf.subdivision_feasibility(wide, rules, streets[:1], tolerance=4)
res.n_lots                                   # 5 lots of 12 m x 30 m

Whole layers in one call:

fc = pf.analyze("parcels.geojson", streets="streets.geojson", tolerance=8,
                setbacks={"front": 5, "side": 3, "rear": 3},
                rules=pf.LotRules(min_area=400, min_frontage=12), subdivide=True,
                on_error="record")
pf.write_geojson(fc, "parcels_measured.geojson")

Features

Area Functions Notes
Geometry area, perimeter, centroid, convex_hull, min_area_rectangle, min_enclosing_circle, points_in_polygon holes and MultiPolygons supported
Orientation Rectangle.angle, Rectangle.azimuth, orientation_difference long axis of the minimum-area rectangle
Shape indices shape_indices, polsby_popper, schwartzberg, fractal_dimension Polsby-Popper, Schwartzberg, Reock, rectangularity, elongation, aspect ratio, area and perimeter convexity, fractal dimension
Frontage frontage -> Frontage, StreetSegments, as_streets street centrelines or block outlines; per-street lengths; corner / through / interior / landlocked
Lot dimensions lot_dimensions -> LotDimensions depth, width, mean depth, width-to-depth ratio
Setbacks buildable_envelope -> Envelope, edge_roles, resolve_setbacks uniform, per edge, or by role (front, side, rear, secondary front)
Lot rules LotRules, check_lot, evaluate_rules minimum area, frontage, depth, width (all user-supplied)
Subdivision subdivision_feasibility, split_parcel, lot_count_bound equal-frontage or equal-area perpendicular cuts
Layers analyze, envelopes, subdivide_collection FeatureCollection in, FeatureCollection out
I/O read_geojson, write_geojson, write_csv, read_rules standard library only

Methods

Geometry

Shape indices

A area, P perimeter, A_h/P_h convex hull area and perimeter, L/W long and short side of the minimum-area rectangle (MBR).

Index Formula Range Source
Polsby-Popper 4 pi A / P^2 (0, 1], circle = 1 Polsby & Popper (1991)
Schwartzberg 2 sqrt(pi A) / P (0, 1], circle = 1 Schwartzberg (1966)
Reock A / A_circle (minimum enclosing circle) (0, 1] Reock (1961)
Rectangularity A / (L W) (0, 1] Rosin (1999)
Elongation 1 - W / L [0, 1), square MBR = 0 MBR (Freeman & Shapira 1975)
Aspect ratio L / W >= 1 MBR (Freeman & Shapira 1975)
Convexity (area, "solidity") A / A_h (0, 1] classical measure, see Zunic & Rosin (2004)
Convexity (perimeter) P_h / P (0, 1] classical measure, see Zunic & Rosin (2004)
Fractal dimension 2 ln(0.25 P) / ln A about 1-2 McGarigal & Marks (1995), FRAGSTATS FRAC

Schwartzberg (1966) defined P / (2 sqrt(pi A)) (>= 1); schwartzberg reports its reciprocal so that all compactness indices point the same way, and schwartzberg_ratio gives the original. The fractal dimension uses the FRAGSTATS correction (a square scores 1); it depends on the length unit and is NaN for A <= 1.

Frontage and lot type

For every parcel edge and street segment, the part of the edge within tolerance of the segment is the intersection of the edge with the segment's capsule (a convex set, so the answer is one interval, computed in closed form). Only parts where the edge runs within max_angle (default 20 degrees) of the street direction count, so side lot lines that end at the street do not. Intervals are merged per edge, so overlapping street lines are not double-counted; by_street gives the length per street id.

With street centrelines, set tolerance to about half the right-of-way width plus a digitising allowance. With block outlines (or lines on the street side of the lots), use a small tolerance.

The primary front is the longest frontage piece by default; primary_rule="shortest" uses the shortest piece, which matches codes that put the front of a corner lot on the narrower street side. depth is the extent of the lot perpendicular to the primary front, width the extent along it, mean_depth = area / width. Without frontage the MBR is used (basis = "mbr"). Zoning codes define lot depth and width in several ways; check that these definitions fit the code you apply.

Buildable envelope

Each lot line is moved inward, parallel to itself, by its setback, and the envelope is the area inside all setback lines. Setbacks are uniform, per edge, or by role: an edge is a front edge when at least half of it is frontage, secondary_front when it is a front edge turned 45 degrees or more from the primary front, rear when it faces away from the primary front, otherwise side.

Subdivision feasibility

subdivision_feasibility first checks the parcel against the rules, bounds the lot count by floor(min(area / min_area, frontage / min_frontage)), then tries that count and fewer, splitting the parcel by straight cuts perpendicular to the primary front (equal frontage or equal area) and re-measuring every new lot's frontage, depth and width against the streets. It returns the largest conforming count (0 if the parcel itself fails, 1 if it cannot be split). It is a screening tool: flag lots, curved streets, easements and access rules are out of scope.

No lot standards or setback distances are built in. They are parameters, because they come from the zoning or subdivision code that applies.

Command line

parcelform metrics parcels.geojson --streets streets.geojson --tolerance 8 \
    --front 5 --side 3 --rear 3 --min-area 400 --min-frontage 12 --subdivide \
    -o parcels_measured.geojson --csv parcels.csv

parcelform envelope parcels.geojson --setback 3 -o envelopes.geojson
parcelform envelope parcels.geojson --streets streets.geojson --tolerance 8 \
    --front 5 --side 3 --rear 4 --secondary-front 3 -o envelopes.geojson

parcelform subdivide parcels.geojson --streets streets.geojson --tolerance 8 \
    --rules rules.json --by area -o lots.geojson --csv lots.csv

--rules takes a JSON object or a two-column key,value CSV with min_area, min_frontage, min_depth, min_width. Without -o and --csv, GeoJSON goes to stdout.

Limitations

References

Citation

@software{eminoglu_parcelform,
  author  = {Eminoğlu, Yusuf},
  title   = {parcelform},
  year    = {2026},
  version = {0.1.2},
  doi     = {10.5281/zenodo.24235570},
  url     = {https://gitlab.com/geophilo1/parcelform_sdk}
}

See also CITATION.cff.

Related Geophilo SDKs

License

MIT, see LICENSE.

Other Geophilo SDKs