dd-l1-vienna-gpkg-manifest
Map (reference ← swipe → agent)
0:00
Inherited a GPKG (vienna_planning) from a colleague who retired last week. Before I commit to scripting against it I need a one-page manifest so I can see what's in there and decide which layers actually feed next month's councillor briefing. Catalog the contents and give me one record per layer. Output manifest.json — a JSON list of these records.
Each record in the list must be a JSON object with exactly five keys: `layer_name` as a string, `crs` as a string in `EPSG:NNNN` form, `geometry_type` as a string matching the layer's native type (e.g. `Point`, `LineString`, `Polygon`, `MultiPolygon`), `feature_count` as an integer, and `bbox` as a list of four numbers `[xmin, ymin, xmax, ymax]` in the layer's native CRS.
0:00
System info
{
"adapter": "openrouter",
"model": "deepseek/deepseek-v4-flash",
"base_url": "https://openrouter.ai/api/v1"
}
0:13
Let me start by examining the GPKG file to understand its contents.
0:13
Bash
ls -lh /work/vienna_planning*
-rw-r--r-- 1 agent agent 512K Jun 16 06:00 /work/vienna_planning.gpkg
0:27
Let me inspect the GPKG to see what layers it contains.
0:27
Bash
python3 -c "
python3 -c "
import geopandas as gpd
import fiona
layers = fiona.list_layers('/work/vienna_planning.gpkg')
print('Layers:', layers)
"
Traceback (most recent call last):
File "<string>", line 4, in <module>
layers = fiona.list_layers('/work/vienna_planning.gpkg')
^^^^^^^^^^^^^^^^^
AttributeError: module 'fiona' has no attribute 'list_layers'. Did you mean: 'listlayers'?
0:38
Let me use the correct function name.
0:38
Bash
python3 -c "
python3 -c "
import fiona
layers = fiona.listlayers('/work/vienna_planning.gpkg')
print('Layers:', layers)
"
Layers: ['districts', 'parks', 'waterbodies', 'schools', 'cafes', 'supermarkets', 'cycleway_segments']
0:59
Now I need to get, for each layer: 1. layer_name 2. crs (EPSG:NNNN) 3. geometry_type 4. feature_count 5. bbox [xmin, ymin, xmax, ymax] in the layer's native CRS Let me write a Python script to extract this info.
0:59
Write
/work/solve.py
content · 53 lines · py
import json
import fiona
from pyproj import CRS
GPKG = "/work/vienna_planning.gpkg"
OUT = "/work/manifest.json"
layers = fiona.listlayers(GPKG)
manifest = []
for name in layers:
with fiona.open(GPKG, layer=name) as src:
crs_obj = src.crs
if crs_obj is None:
epsg_str = "None"
else:
# Try to get EPSG code
try:
crs = CRS(crs_obj)
epsg = crs.to_epsg()
if epsg is not None:
epsg_str = f"EPSG:{epsg}"
else:
# fallback: use the authority string from fiona
epsg_str = str(crs_obj).strip()
except Exception:
epsg_str = str(crs_obj).strip()
# geometry type - use schema
geom_type = src.schema.get("geometry", "Unknown")
# feature count
count = len(src)
# bounding box - from the driver metadata or compute
# fiona's bounds are in native CRS
bounds = src.bounds # (minx, miny, maxx, maxy)
bbox = [bounds[0], bounds[1], bounds[2], bounds[3]]
manifest.append({
"layer_name": name,
"crs": epsg_str,
"geometry_type": geom_type,
"feature_count": count,
"bbox": bbox,
})
with open(OUT, "w") as f:
json.dump(manifest, f, indent=2)
print(json.dumps(manifest, indent=2))
print(f"\nWrote {OUT}")
Wrote /work/solve.py (1447 chars).
1:03
Let me run the script and see the results.
1:03
Bash
cd /work && python3 solve.py
[
{
"layer_name": "districts",
"crs": "EPSG:31287",
"geometry_type": "Polygon",
"feature_count": 22,
"bbox": [
623867.388822485,
481236.583612549,
626371.307999455,
484403.731552694
]
},
{
"layer_name": "parks",
"crs": "EPSG:31287",
"geometry_type": "MultiPolygon",
"feature_count": 119,
"bbox": [
623851.990195953,
481200.667401249,
626620.943886552,
485539.347967185
]
},
{
"layer_name": "waterbodies",
"crs": "EPSG:31287",
"geometry_type": "Polygon",
"feature_count": 33,
"bbox": [
624288.852105613,
481236.663206409,
626747.861158499,
484132.02126858
]
},
{
"layer_name": "schools",
"crs": "EPSG:31287",
"geometry_type": "Point",
"feature_count": 40,
"bbox": [
624000.002417057,
481214.738713116,
626259.54214065,
484178.878650108
]
},
{
"layer_name": "cafes",
"crs": "EPSG:31287",
"geometry_type": "Point",
"feature_count": 392,
"bbox": [
623796.529863561,
481107.254012981,
626399.561812176,
484498.920900565
]
},
{
"layer_name": "supermarkets",
"crs": "EPSG:31287",
"geometry_type": "Point",
"feature_count": 87,
"bbox": [
623794.054995056,
481148.387037234,
626392.616478676,
484489.919541478
]
},
{
"layer_name": "cycleway_segments",
"crs": "EPSG:31287",
"geometry_type": "LineString",
"feature_count": 271,
"bbox": [
623787.493213129,
481134.932587822,
626619.16319226,
485245.662485324
]
}
]
Wrote /work/manifest.json
1:08
Let me verify the output file exists and is proper JSON, and also sanity-check the coordinates. EPSG:31287 is MGI / Austria GK East — that's a metric CRS for eastern Austria (Vienna), so coordinate magnitudes around 600k-700k are correct for Easting and 400k-500k for Northing. Looks good. Let me also double-check the JSON file.
1:08
Bash
python3 -c "import json; d=json.load(open('/work/manifest.json')); print(f'{len(...
7 records, keys=['layer_name', 'crs', 'geometry_type', 'feature_count', 'bbox']
1:23
All good. The manifest.json has exactly the 5 keys requested, all layers are cataloged. Let me verify the file exists.
1:23
Bash
ls -la /work/manifest.json
-rw-r--r-- 1 agent agent 1666 Jun 16 06:01 /work/manifest.json
1:27
Everything looks good. The manifest has been written with all the required fields. Let me verify the full content matches what's expected.
1:27