Skip to content

Commit

Permalink
Add coverage information
Browse files Browse the repository at this point in the history
  • Loading branch information
frafra committed Aug 2, 2024
1 parent 7239873 commit 9bcf6a5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,25 @@ def generate_mapproxy_config(url, output: Path, version):
sources = {}
layers = []

for layer in wms.contents:
slug = slugify(layer)
for layer_name in wms.contents:
layer = wms[layer_name]
slug = slugify(layer_name)
sources[slug] = {
"type": "wms_retry",
"retry": {"error_message": "Overforbruk"},
"req": {
"url": url + "?",
"layers": layer,
"layers": layer_name,
"transparent": True,
},
}

layers.append({"name": layer, "title": layer, "sources": [slug]})
bbox = layer.boundingBoxWGS84
if bbox:
sources[slug]["coverage"] = {
"bbox": list(bbox),
"srs": "EPSG:4326",
}
layers.append({"name": layer_name, "title": layer_name, "sources": [slug]})

with output.open("w") as f:
yaml.dump(
Expand Down

0 comments on commit 9bcf6a5

Please sign in to comment.