dd-l1-london-parks-count
Map (reference ← swipe → agent)
0:00
I've got inner-London parks (london_parks) and I'm sizing the corpus before commissioning a green-space accessibility study. How many of those parks come in at one hectare or more, what's their combined area in hectares, and what bounding box would I draw around that subset on a WGS84 map? Output parks_summary.json with keys count, total_area_ha, and bbox_wgs84 (as a [xmin, ymin, xmax, ymax] array).
0:00
System info
{
"adapter": "openrouter",
"model": "google/gemma-4-26b-a4b-it",
"base_url": "https://openrouter.ai/api/v1"
}
0:07
Bash
ls -F
london_parks.fgb
0:22
Write
/work/solve.py
content · 48 lines · py
import geopandas as gpd
import json
def main():
# Load the parks data
gdf = gpd.read_file('london_parks.fgb')
# Ensure we are working with an area-friendly CRS for calculations
# EPSG:27700 is the British National Grid, good for London area measurements
original_crs = gdf.crs
gdf_projected = gdf.to_crs(epsg=27700)
# Calculate area in hectares (1 hectare = 10,000 m^2)
gdf_projected['area_ha'] = gdf_projected.geometry.area / 10000.0
# Filter parks that are 1 hectare or more
large_parks = gdf_projected[gdf_projected['area_ha'] >= 1.0].copy()
# Calculate count and total area
count = len(large_parks)
total_area_ha = large_parks['area_ha'].sum()
# Calculate bounding box in WGS84
# Convert large_parks back to WGS84
large_parks_wgs84 = large_parks.to_crs(epsg=4326)
if not large_parks_wgs84.empty:
bounds = large_parks_wgs84.total_bounds # [xmin, ymin, xmax, ymax]
else:
bounds = [0.0, 0.0, 0.0, 0.0]
# Prepare the output dictionary
summary = {
"count": int(count),
"total_area_ha": float(total_area_ha),
"bbox_wgs84": [float(bounds[0]), float(bounds[1]), float(bounds[2]), float(bounds[3])]
}
# Write to JSON
with open('parks_summary.json', 'w') as f:
json.dump(summary, f, indent=4)
print("Summary generated successfully.")
print(summary)
if __name__ == "__main__":
main()
Wrote /work/solve.py (1481 chars).
0:24
Bash
python solve.py
Summary generated successfully.
{'count': 42, 'total_area_ha': 519.1620805430861, 'bbox_wgs84': [-0.19932378751294652, 51.49147199538401, -0.08248178747996572, 51.54706589542573]}
0:29
Bash
cat parks_summary.json
{
"count": 42,
"total_area_ha": 519.1620805430861,
"bbox_wgs84": [
-0.19932378751294652,
51.49147199538401,
-0.08248178747996572,
51.54706589542573
]
}
1:10