spa-l2-lagos-hotspot-overlaps
Map (reference ← swipe → agent)
0:00
Hot-spot map for the Lagos housing brief. `lagos_landuse` carries land-use polygons with a population density attribute; `lagos_hex_grid` is a hex grid. I need the top 10 % of hex cells ranked by area-weighted mean population density across overlapping land-use polygons. Tiny polygons under 100 m² are noise and should be excluded.
I need two output files that share exactly the same set of `hex_id` values, one row per cell. `hotspots.geoparquet` is a GeoParquet (Polygon or MultiPolygon geometry) in Nigeria's national grid with columns `hex_id`, `rank`, `area_weighted_density`, and `geometry`. `hotspot_ranking.parquet` is a plain Parquet with no geometry, carrying `hex_id`, `rank`, `area_weighted_density`, `n_overlap_polygons` (integer), and `n_slivers_filtered` (integer). In both files `rank` must be a unique integer starting at 1 where ascending rank corresponds to descending `area_weighted_density`.
0:00
System info
{
"adapter": "openrouter",
"model": "google/gemma-4-26b-a4b-it",
"base_url": "https://openrouter.ai/api/v1"
}
0:01
Bash
ls -F
ls -F
lagos_hex_grid.geojson lagos_landuse.geojson
0:35
Write
/work/inspect_data.py
content · 16 lines · py
import geopandas as gpd
landuse = gpd.read_file('lagos_landuse.geojson')
hex_grid = gpd.read_file('lagos_hex_grid.geojson')
print("Landuse columns:", landuse.columns)
print("Landuse first rows:", landuse.head())
print("Landuse geometry type:", landuse.geometry.type.unique())
print("\nHex grid columns:", hex_grid.columns)
print("Hex grid first rows:", hex_grid.head())
print("Hex grid geometry type:", hex_grid.geometry.type.unique())
print("\nLanduse CRS:", landuse.crs)
print("Hex grid CRS:", hex_grid.crs)
Wrote /work/inspect_data.py (514 chars).
0:38
call:Bash{command:<|"|>python /work/inspect_data.py
<|"|>}<tool_call|>