This Chat is read-only. Login to resume chatting.
{
"type": "relation",
"id": 12345,
"bounds": {
"minlat": 48.8566,
"minlon": 2.3522,
"maxlat": 48.8606,
"maxlon": 2.3582
}
}import json
# Example Overpass response (replace with your actual response)
response = {
"elements": [
{
"type": "relation",
"id": 1,
"bounds": {"minlat": 48.8566, "minlon": 2.3522, "maxlat": 48.8606, "maxlon": 2.3582}
},
{
"type": "relation",
"id": 2,
"bounds": {"minlat": 48.8556, "minlon": 2.3512, "maxlat": 48.8616, "maxlon": 2.3592}
}
]
}
# Initialize variables
minlat = minlon = float('inf')
maxlat = maxlon = float('-inf')
# Iterate over all relations and update the merged bbox
for element in response["elements"]:
if "bounds" in element:
minlat = min(minlat, element["bounds"]["minlat"])
minlon = min(minlon, element["bounds"]["minlon"])
maxlat = max(maxlat, element["bounds"]["maxlat"])
maxlon = max(maxlon, element["bounds"]["maxlon"])
# Resulting merged bbox
merged_bbox = (minlat, minlon, maxlat, maxlon)
print(merged_bbox)[out:json][timeout:25];
{{geocodeArea:Marseille}}->.searchArea;
(
relation["route"="subway"](area.searchArea);
);
out bb;
>;
out bb;