Generate 駅勢圏 (station catchment areas) for Japanese railway stations using Voronoi tessellation
Project description
jp-station-neighborhoods
Generate ekiseiken (station catchment areas) for Japanese railway stations using Voronoi tessellation.
Install
pip install jp-station-neighborhoods
Quick Start
from jp_station_neighborhoods import (
download_boundaries,
run_station_neighborhoods,
PREFECTURE_BBOX,
)
boundaries = download_boundaries(prefecture="tokyo")
neighborhoods = run_station_neighborhoods(
boundaries_gdf=boundaries,
bbox=PREFECTURE_BBOX["tokyo"],
prefix="tokyo",
)
print(f"{len(neighborhoods)} neighborhoods")
# Output HTML map at ~/.cache/jp-station-neighborhoods/maps/tokyo_station_neighborhoods_map.html
What is Ekiseiken?
Ekiseiken (literally "station influence area") is the walk-shed around a train station -- the area where that station is the closest or most convenient option. In Japanese real estate and urban planning, ekiseiken determines property values, commercial zoning, and transit-oriented development decisions. This package generates these catchment areas computationally using Voronoi tessellation, producing non-overlapping polygons that partition an entire study area among its stations.
API Reference
Pipeline
run_station_neighborhoods(boundaries_gdf, bbox, output_dir=..., prefix="tokyo")
Full pipeline: download boundaries, fetch stations from OSM, cluster, Voronoi tessellate, save GeoParquet/GeoJSON, and build an interactive Folium map. Returns a GeoDataFrame of neighborhood polygons.
Data Fetching
fetch_stations(bbox, cache_dir) -> GeoDataFrame
Fetch railway stations from OpenStreetMap via Overpass API. Returns station points with line counts derived from route relations.
download_boundaries(prefecture=None, scope="prefecture", cache_dir=...) -> GeoDataFrame
Download MLIT N03 administrative boundaries. Supports municipality-level (scope="prefecture") or prefecture-level (scope="country") polygons.
Processing
cluster_stations(stations_gdf) -> GeoDataFrame
Group nearby stations into blocks using DBSCAN (400m eps). Classifies each block as major_hub (3+ lines), medium, or minor.
build_neighborhoods(blocks_gdf, study_area) -> GeoDataFrame
Generate Voronoi neighborhood polygons from station blocks. Clips to importance-based buffer circles and fills residual gaps.
Visualization
build_map(neighborhoods_gdf, stations_gdf, output_path) -> None
Create an interactive Folium HTML map with color-coded neighborhoods, station markers, and tooltips.
Reference Data
PREFECTURE_BBOX: dict[str, tuple[float, float, float, float]]
WGS84 bounding boxes (west, south, east, north) for all 47 Japanese prefectures.
How It Works
- Fetch stations from OSM -- Queries the Overpass API for railway stations, halts, and subway stops within a bounding box. Enriches each station with a line count from route relation data using spatial matching (200m radius).
- DBSCAN clustering (400m) -- Groups stations within 400m into "station blocks" (e.g. JR Shinjuku + Seibu-Shinjuku + Shinjuku-sanchome become one block). Each block gets an importance class based on the maximum line count of its members.
- Voronoi tessellation -- Computes Voronoi cells for each station block, then intersects each cell with an importance-based buffer circle (major hub: 1500m, medium/minor: 1200m) and the study area boundary.
- Clip and fill -- Intersects all neighborhoods with administrative boundaries. Remaining gaps become "non-station zones," producing a complete partition of the study area with no overlaps.
Data Sources
- Stations: OpenStreetMap via Overpass API
- Administrative boundaries: MLIT N03 (Ministry of Land, Infrastructure, Transport and Tourism)
Configuration
Key constants used in the pipeline:
| Parameter | Value | Description |
|---|---|---|
DBSCAN_EPS_M |
400 | Clustering radius in meters |
MAJOR_HUB_LINES |
3 | Minimum lines for major hub classification |
| Buffer (major hub) | 1500m | Neighborhood radius for major hubs |
| Buffer (medium/minor) | 1200m | Neighborhood radius for other stations |
| Projected CRS | EPSG:6677 | Japan Plane Rectangular IX (for metric ops) |
| Output CRS | EPSG:4326 | WGS84 (all outputs) |
License
MIT -- see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jp_station_neighborhoods-0.1.0.tar.gz.
File metadata
- Download URL: jp_station_neighborhoods-0.1.0.tar.gz
- Upload date:
- Size: 26.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62cc0b820d0f42388fac075595168aee57d98b1f2bf052e639e9a091ddb968dd
|
|
| MD5 |
8d9f3eed74c4d2307ccfe19327fe5d0e
|
|
| BLAKE2b-256 |
955c1ec26bebe6cc6e3898143be4016d76ba8155834cdf661ace1d59417422fd
|
Provenance
The following attestation bundles were made for jp_station_neighborhoods-0.1.0.tar.gz:
Publisher:
publish.yml on Leuvtern/jp-station-neighborhoods
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jp_station_neighborhoods-0.1.0.tar.gz -
Subject digest:
62cc0b820d0f42388fac075595168aee57d98b1f2bf052e639e9a091ddb968dd - Sigstore transparency entry: 1147221858
- Sigstore integration time:
-
Permalink:
Leuvtern/jp-station-neighborhoods@5f47cf072f35363efb939c9fb9b997d3acbf8e60 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Leuvtern
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5f47cf072f35363efb939c9fb9b997d3acbf8e60 -
Trigger Event:
push
-
Statement type:
File details
Details for the file jp_station_neighborhoods-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jp_station_neighborhoods-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b00f1133d4175b77ca5a814907766c37d802ca8b9e4622fbd43e95fd04ab5ddd
|
|
| MD5 |
2d7a10599a4076a1f77999ed55c140f7
|
|
| BLAKE2b-256 |
3f6bd896521464c6df4a936692d3e769a81bbc0a807053419335126306458cfe
|
Provenance
The following attestation bundles were made for jp_station_neighborhoods-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Leuvtern/jp-station-neighborhoods
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jp_station_neighborhoods-0.1.0-py3-none-any.whl -
Subject digest:
b00f1133d4175b77ca5a814907766c37d802ca8b9e4622fbd43e95fd04ab5ddd - Sigstore transparency entry: 1147221910
- Sigstore integration time:
-
Permalink:
Leuvtern/jp-station-neighborhoods@5f47cf072f35363efb939c9fb9b997d3acbf8e60 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Leuvtern
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5f47cf072f35363efb939c9fb9b997d3acbf8e60 -
Trigger Event:
push
-
Statement type: