dd-l1-london-parks-count

Status: done
Score: 1.000
Duration: 0:38
Cost: 0.06¢
Model: google/gemma-4-26b-a4b-it

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:02
Bash ls -F
ls -F
london_parks.fgb
0:21
Write /work/solve.py
content · 56 lines · py
import geopandas as gpd
import json

def main():
    # Load the parks data
    gdf = gpd.read_file('london_parks.fgb')
    
    # The input is likely in a projected CRS (e.g., EPSG:27700 for UK).
    # We need to ensure we can calculate area in square meters/hectares accurately.
    # Let's check the current CRS.
    print(f"Original CRS: {gdf.crs}")

    # Filter parks that are 1 hectare or more.
    # 1 hectare = 10,000 square meters.
    # First, ensure we are in a projected CRS to calculate area correctly.
    # If it's already projected, great. If not, we'll reproject to EPSG:27700.
    if gdf.crs is None or gdf.crs.is_geographic:
        gdf_projected = gdf.to_crs(epsg=27700)
    else:
        gdf_projected = gdf.copy()

    # Calculate area in hectares (1 ha = 10,000 m^2)
    gdf_projected['area_ha'] = gdf_projected.geometry.area / 10000.0

    # Filter subset
    subset = gdf_projected[gdf_projected['area_ha'] >= 1.0].copy()

    # Calculate summary statistics
    count = len(subset)
    total_area_ha = subset['area_ha'].sum()

    # Calculate bounding box in WGS84 (EPSG:4326)
    if count > 0:
        subset_wgs84 = subset.to_crs(epsg=4326)
        bounds = subset_wgs84.total_bounds  # [xmin, ymin, xmax, ymax]
        bbox_wgs84 = bounds.tolist()
    else:
        bbox_wgs84 = []

    # Prepare output
    summary = {
        "count": int(count),
        "total_area_ha": float(total_area_ha),
        "bbox_wgs84": bbox_wgs84
    }

    # Write to JSON
    with open('parks_summary.json', 'w') as f:
        json.dump(summary, f, indent=4)
    
    print("Summary calculation complete.")
    print(summary)

if __name__ == "__main__":
    main()
Wrote /work/solve.py (1677 chars).
0:23
Bash python solve.py
python solve.py
Original CRS: EPSG:27700
Summary calculation complete.
{'count': 42, 'total_area_ha': 519.1620805430861, 'bbox_wgs84': [-0.19932378751294652, 51.49147199538401, -0.08248178747996572, 51.54706589542573]}
0:36