Skip to main content

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

  1. 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).
  2. 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.
  3. 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.
  4. 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jp_station_neighborhoods-0.1.0.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jp_station_neighborhoods-0.1.0-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

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

Hashes for jp_station_neighborhoods-0.1.0.tar.gz
Algorithm Hash digest
SHA256 62cc0b820d0f42388fac075595168aee57d98b1f2bf052e639e9a091ddb968dd
MD5 8d9f3eed74c4d2307ccfe19327fe5d0e
BLAKE2b-256 955c1ec26bebe6cc6e3898143be4016d76ba8155834cdf661ace1d59417422fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for jp_station_neighborhoods-0.1.0.tar.gz:

Publisher: publish.yml on Leuvtern/jp-station-neighborhoods

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jp_station_neighborhoods-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jp_station_neighborhoods-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b00f1133d4175b77ca5a814907766c37d802ca8b9e4622fbd43e95fd04ab5ddd
MD5 2d7a10599a4076a1f77999ed55c140f7
BLAKE2b-256 3f6bd896521464c6df4a936692d3e769a81bbc0a807053419335126306458cfe

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page