crs-l3-tokyo-jgd-crossings
Map (reference ← swipe → agent)
0:00
I'm rebuilding the road-safety dashboard for Tokyo's 23 special wards. For each ward I need to know how often the drivable road network crosses the ward boundary (please skip service roads), plus a 50 m buffer around every crossing for jurisdictional reporting. Pull the data from current OSM via Overpass. Run the engineering layers in the regional metric coordinate system so the distances and areas come out in real metres.
Save everything to a single `tokyo_crossings.gpkg` with five layers:
- `wards_jgd` (Polygon): the 23 ward boundaries.
- `crossing_points` (Point): one point at each place a road crosses a ward boundary.
- `crossing_buffers_50m` (Polygon): a 50 m buffer around each crossing point.
- `buffer_ward_intersection` (Polygon): each buffer clipped to the ward whose boundary it crossed.
- `ward_crossing_density_wgs84` (Polygon): one row per ward with `ward_id`, `crossing_count`, `ward_area_km2`, and `crossings_per_km2`. This is what the public dashboard reads, so it goes in WGS84 while the other four stay in the metric grid.
Use each ward's OSM relation id as `ward_id`, and carry the English and native ward names as `ward_name_en` and `ward_name` on every layer that's tied to a specific ward.
0:00
System info
{
"adapter": "openrouter",
"model": "google/gemma-4-26b-a4b-it",
"base_url": "https://openrouter.ai/api/v1"
}
0:01
Bash
pip install osmnx geopandas shapely pyproj
Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: osmnx in /usr/local/lib/python3.14/site-packages (2.1.0) Requirement already satisfied: geopandas in /usr/local/lib/python3.14/site-packages (1.1.3) Requirement already satisfied: shapely in /usr/local/lib/python3.14/site-packages (2.1.2) Requirement already satisfied: pyproj in /usr/local/lib/python3.14/site-packages (3.7.2) Requirement already satisfied: networkx>=2.5 in /usr/local/lib/python3.14/site-packages (from osmnx) (3.6.1) Requirement already satisfied: numpy>=1.24 in /usr/local/lib/python3.14/site-packages (from osmnx) (2.4.6) Requirement already satisfied: pandas>=1.5 in /usr/local/lib/python3.14/site-packages (from osmnx) (3.0.3) Requirement already satisfied: requests>=2.30 in /usr/local/lib/python3.14/site-packages (from osmnx) (2.34.2) Requirement already satisfied: pyogrio>=0.7.2 in /usr/local/lib/python3.14/site-packages (from geopandas) (0.12.1) Requirement already satisfied: packaging in /usr/local/lib/python3.14/site-packages (from geopandas) (26.2) Requirement already satisfied: certifi in /usr/local/lib/python3.14/site-packages (from pyproj) (2026.5.20) Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.14/site-packages (from pandas>=1.5->osmnx) (2.9.0.post0) Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.14/site-packages (from python-dateutil>=2.8.2->pandas>=1.5->osmnx) (1.17.0) Requirement already satisfied: charset_normalizer<4,>=2 in /usr/local/lib/python3.14/site-packages (from requests>=2.30->osmnx) (3.4.7) Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.14/site-packages (from requests>=2.30->osmnx) (3.18) Requirement already satisfied: urllib3<3,>=1.26 in /usr/local/lib/python3.14/site-packages (from requests>=2.30->osmnx) (2.7.0)
1:28
Write
Invalid JSON arguments: Unterminated string starting at: line 1 column 13 (char 12)