greenrule

Urban green space provision and exposure indicators: the 3-30-300 rule, the WHO Europe 300 m green space proximity indicator, green space per capita, NDVI buffer exposure and equity summaries.

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

greenrule

PyPI version Python versions pipeline status License: MIT DOI Downloads

Urban green space provision and exposure indicators for homes, neighbourhoods and zones.

greenrule computes the green-space measures that planning and public-health studies report most often: the 3-30-300 rule per home, the WHO Europe 300 m proximity indicator, green space per capita, NDVI greenness in buffers around homes, and how evenly all of these are distributed across zones. Distances are straight-line or along a street network built from GeoJSON lines. It needs only NumPy.

Installation

pip install greenrule

Requires Python 3.9 or newer. Coordinates must be in a projected CRS in metres.

Quickstart

import greenrule as gr

greens = gr.GreenSpaces.from_geojson(gr.read_geojson("parks.geojson"))
homes = gr.read_points("buildings.geojson")          # points, or polygons -> centroids
pop = homes.column("residents")

# WHO Europe (2016): 300 m linear distance, 0.5 ha core and 1 ha additional indicator
both = gr.who_proximity_both(homes.xy, greens, population=pop)
both["core_0.5ha"].share, both["additional_1ha"].share

# 3-30-300 per home
canopy = gr.Raster(canopy_array, x0=500000, y0=4300000, dx=1, dy=1)   # 1 = tree canopy
net = gr.Network([gr.read_geojson("streets.geojson")])
res = gr.assess(
    homes.xy, greens, pop,
    tree_counts=homes.column("visible_trees"),   # from street-view or viewshed work
    canopy=canopy, canopy_radius=250,            # neighbourhood = 250 m buffer (your choice)
    network=net, max_snap=100,                   # network distance, Euclidean fallback
    zones=homes.labels("district"),
)
res.summary()["rule_3_30_300"]["share_all_three"]
res.summary()["equity"]["gini_between_zones"]
gr.write_json(gr.points_to_geojson(homes, res.to_rows()), "homes_green.geojson")

Single pieces are plain functions: evaluate_3_30_300, who_proximity, euclidean_distance, network_distance, green_provision, ndvi, ndvi_exposure, gini, lorenz_curve, equity_summary. See examples/quickstart.py for a run on synthetic data.

Features

Area Functions Notes
3-30-300 evaluate_3_30_300 -> Rule333Result, visible_tree_counts, trees_within_radius, canopy_share_zones, canopy_share_buffers thresholds 3 / 30 % / 300 m; visibility is a user input
WHO Europe 2016 who_proximity, who_proximity_both -> ProximityResult 300 m linear distance; 0.5 ha core, 1 ha additional
Distances euclidean_distance, network_distance -> GreenDistance, Network boundary distance; entrances or boundary access points; Euclidean fallback
Provision green_provision -> Provision green m2, green share, m2 per resident by zone
Exposure ndvi, ndvi_exposure -> Exposure, Raster mean, median, SD, share of cells above a threshold
Equity gini, lorenz_curve, share_meeting, equity_summary population-weighted
One call assess -> Assessment rows per home and a summary
I/O read_geojson, read_points, areas_from_geojson, points_to_geojson, write_csv, write_json GeoJSON and CSV

Methods

The 3-30-300 rule

Konijnendijk (2023) proposes that everyone should see at least 3 well-established trees from their home (and school or workplace), that every neighbourhood should have at least 30 % tree canopy cover, and that every residence should lie no more than 300 m from the nearest public green space. The article mentions a park of at least 1 ha (after WHO) but the rule itself sets no minimum size, and it does not say whether the 300 m is straight-line or walking distance. These three thresholds are the defaults (MIN_TREES, MIN_CANOPY, MAX_DISTANCE_M). The rule leaves several choices open, so they are explicit parameters here and should be reported:

WHO Europe (2016) Urban Green Space Indicator

WHO Regional Office for Europe (2016, chapter 4) defines the indicator as the proportion of the population living within 300 m linear distance to the boundary of a green space, with two recommended alternative minimum sizes: 0.5 ha (core indicator) and 1 ha (additional indicator), and recommends reporting both. Linear distance from the green-space edge is treated there as an appropriate proxy for walking distance; additional runs with other distances (for example 200 m and 500 m) are recommended. who_proximity follows this definition (default 0.5 ha); who_proximity_both returns both sizes. Selecting the green spaces (the report uses Urban Atlas class 1.4.1 "Green urban areas") is up to the user.

Distances and the network

Provision, exposure and equity

Command line

greenrule who homes.geojson parks.geojson --population-field pop --both --summary who.json
greenrule rule homes.geojson parks.geojson --population-field pop --trees-field visible_trees \
    --canopy canopy.npy --transform=500000,4300000,1,1 --canopy-radius 250 \
    --network streets.geojson --max-snap 100 --zone-field district \
    -o homes_333.geojson --csv homes_333.csv --summary rule.json
greenrule exposure homes.csv --ndvi ndvi.npy --transform=500000,4300000,10,10 --radius 300
greenrule provision districts.geojson parks.geojson --population-field pop --method sample \
    --resolution 5 --csv provision.csv
greenrule equity homes_333.csv --criteria meets_3,meets_30,meets_300 --population population \
    --zone district --value green_distance

Homes can be GeoJSON or CSV with x,y columns. Rasters are 2-D .npy arrays with --transform x0,y0_top,dx,dy (write it with = when x0 is negative). Summaries go to stdout as JSON unless --summary or -o is given.

Limitations

References

Citation

@software{eminoglu_greenrule,
  author  = {Eminoğlu, Yusuf},
  title   = {greenrule},
  year    = {2026},
  version = {0.1.2},
  doi     = {10.5281/zenodo.24235574},
  url     = {https://gitlab.com/geophilo1/greenrule_sdk}
}

See also CITATION.cff.

Related Geophilo SDKs

License

MIT, see LICENSE.

Other Geophilo SDKs