GenPlanner logo
https://img.shields.io/badge/code%20style-black-000000.svg https://img.shields.io/pypi/v/genplanner.svg https://github.com/DDonnyy/GenPlanner-lib/actions/workflows/release.yml/badge.svg https://github.com/DDonnyy/GenPlanner-lib/actions/workflows/docs.yml/badge.svg https://img.shields.io/badge/GitHub-GenPlanner--lib-181717?logo=github https://img.shields.io/badge/license-Proprietary--NC-red.svg

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

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: