GenPlanner is a territorial zoning engine for generating spatially consistent territorial zones (and optionally blocks) from polygonal territories.
It combines:
ratio-based functional zoning
adjacency constraints via relation matrices
optional fixed spatial anchors
integration of existing zones
road-based splitting
MILP-based multi-feature allocation
geometric optimization via Voronoi splitting
Quickstart¶
Installation¶
pip install genplanner
Python 3.11 and 3.12 are supported.
Minimal example¶
import geopandas as gpd
from genplanner import GenPlanner
from genplanner.zones import basic_func_zone
territory = gpd.read_file("territory.geojson")
gp = GenPlanner(features_gdf=territory)
zones, roads = gp.features2terr_zones(
funczone=basic_func_zone
)
Generate blocks¶
blocks, roads = gp.features2terr_zones2blocks(
funczone=basic_func_zone
)
With relation constraints¶
zones, roads = gp.features2terr_zones(
relation_matrix="default"
)
With fixed anchor points¶
from shapely.geometry import Point
from genplanner.zones import default_terr_zones
fix_points = gpd.GeoDataFrame(
{
"fixed_zone": [default_terr_zones.residential_terr],
"geometry": [Point(30.1, 59.9)],
},
crs=territory.crs,
)
zones, roads = gp.features2terr_zones(
terr_zones_fix_points=fix_points
)
Documentation¶
Design philosophy¶
GenPlanner is built around a small set of composable primitives:
Zoning Primitives define what spatial program should be achieved.
Zone Relations define which zones may or may not be adjacent.
GenPlanner orchestrates preprocessing, validation, optimization and splitting.
Errors define a strict, explicit failure model.
The goal is deterministic, reproducible zoning with clear constraints and explicit spatial control.
License¶
This project is distributed under a Proprietary Non-Commercial License.
You are allowed to use the software for non-commercial purposes only.
The following actions are prohibited without prior permission from the author:
copying the source code
modifying the software
redistributing the software
commercial use
See the full license text here: