| name | overpass-skill |
| description | Query OpenStreetMap data via Overpass API to find critical infrastructure, buildings, and natural objects within a bounding box region. Use when user provides coordinates (lat/lon bounding box) and asks about hospitals, fire stations, roads, railways, power plants, water supplies, shelters, bridges, offices, rivers, lakes, or building density in an area. Also use for analyzing infrastructure coverage and identifying areas with missing or incomplete mapping data. |
Overpass API Query Skill
This skill queries the Overpass API to extract geographic data from OpenStreetMap for a specified bounding box region.
When to Use
Use this skill when the user:
- Provides geographic coordinates (bounding box) and asks about infrastructure in that area
- Mentions hospitals, fire stations, roads, railways, power plants, water systems, shelters, or bridges
- Asks about building density, office buildings, or population indicators
- Wants information about rivers, lakes, or natural water features
- Asks about data quality or missing mapping in an area
Bounding Box Format
The user should provide coordinates as: south,west,north,east (or minLat,minLon,maxLat,maxLon)
Example: "50.7,7.1,50.8,7.25" means:
- South (minLat): 50.7
- West (minLon): 7.1
- North (maxLat): 50.8
- East (maxLon): 7.25
If the user provides coordinates in a different format (like "lat1,lon1 to lat2,lon2" or "from X to Y"), interpret and convert to the south,west,north,east format.
API Endpoint
The Overpass API endpoint is: https://overpass/api/interpreter
Or use the local endpoint if configured: http://localhost:3000/api/interpreter
Send POST requests with the query in the data field.
Query Categories
Build separate queries for each category and combine results:
1. Critical Infrastructure
Hospitals/Healthcare:
[out:json][timeout:30];
(
nwr["amenity"="hospital"]({{bbox}});
nwr["health"="hospital"]({{bbox}});
nwr["building"~"."]["name"~"hospital","hospital"."i"]({{bbox}});
);
out body;
Fire Departments/Police:
[out:json][timeout:30];
(
nwr["amenity"="fire_station"]({{bbox}});
nwr["amenity"="police"]({{bbox}});
nwr["building"~"."]["name"~"fire","police"."i"]({{bbox}});
);
out body;
Roads (all types):
[out:json][timeout:30];
way["highway"]({{bbox}});
out body;
Railways/Train Tracks:
[out:json][timeout:30];
(
way["railway"~"^(rail|light_rail|tram)"]({{bbox}});
way["railway"="rail"]({{bbox}});
);
out body;
Power Plants/Energy:
[out:json][timeout:30];
(
nwr["power"="plant"]({{bbox}});
nwr["power"="substation"]["power"="plant"]({{bbox}});
nwr["building"~"."]["name"~"power","energy"."i"]({{bbox}});
);
out body;
Water Supply:
[out:json][timeout:30];
(
nwr["amenity"="water"]({{bbox}});
nwr["water"="water_tower"]({{bbox}});
nwr["building"~"."]["name"~"water","reservation"."i"]({{bbox}});
);
out body;
Bunkers/Military:
[out:json][timeout:30];
(
nwr["military"="bunker"]({{bbox}});
nwr["building"~"."]["name"~"bunker","shelter"."i"]["military"~"."]({{bbox}});
);
out body;
Shelters:
[out:json][timeout:30];
(
nwr["shelter"]({{bbox}});
nwr["highway"="bus_stop"]["shelter"]({{bbox}});
);
out body;
Bridges:
[out:json][timeout:30];
(
way["bridge"]({{bbox}});
way["bridge"="yes"]({{bbox}});
way["bridge"="viaduct"]({{bbox}});
nwr["bridge"="yes"]({{bbox}});
node["bridge"="yes"]({{bbox}});
// Also include layer relationships for elevated roads
way["layer"~"^[1-9]"]["highway"]({{bbox}});
);
out body;
All Critical Buildings (combined query):
[out:json][timeout:60];
(
// Government/Administrative
nwr["building"~"."]["name"~"government","admin","government_building"."i"]({{bbox}});
// Military
nwr["building"~"."]["name"~"military,barracks,armyy"."i"]({{bbox}});
// Emergency services
nwr["amenity"~"^(emergency|ambulance)"]({{bbox}});
// Communication hubs
nwr["telecom"]({{bbox}});
);
out body;
2. Buildings
Large Offices:
[out:json][timeout:30];
(
nwr["building"="office"]({{bbox}});
nwr["building"~"."]["name"~"office","headquarters"."i"]({{bbox}});
nwr["building"~"."]["name"~"headquarters HQ"."i"]({{bbox}});
);
out body;
Population Density Indicators:
[out:json][timeout:30];
(
// All buildings
nwr["building"]({{bbox}});
// Building clusters
nwr["building"~"."]({{bbox}});
);
out body;
3. Natural Objects
Rivers:
[out:json][timeout:30];
(
way["natural"="river"]({{bbox}});
way["water"="river"]({{bbox}});
nwr["natural"="river"]({{bbox}});
);
out body;
Lakes/Water Bodies:
[out:json][timeout:30];
(
way["natural"="lake"]({{bbox}});
way["water"="lake"]({{bbox}});
nwr["natural"="lake"]({{bbox}});
nwr["water"="pond"]({{bbox}});
nwr["water"="reservoir"]({{bbox}});
nwr["water"="basin"]({{bbox}});
way["landuse"="reservoir"]({{bbox}});
nwr["natural"="water"]({{bbox}});
nwr["water"]({{bbox}});
);
out body;
Buildings Near Water:
[out:json][timeout:60];
(
// Find water features (nodes, ways, relations)
(way["natural"~"^(river|lake|water)"]({{bbox}}); node["natural"~"^(river|lake|water)"]({{bbox}});)->.water;
// Find buildings within 100m of water
nwr["building"](around.water:100);
);
out center;
4. Missing/Incomplete Data
Buildings with missing or incomplete data:
[out:json][timeout:60];
(
// Buildings with no name (missing data)
nwr["building"]["name"!"*"]({{bbox}});
// Buildings with generic building=yes (no specific type)
nwr["building"="yes"]({{bbox}});
// Buildings missing address street/place
nwr["building"]["addr:street"!"*"]({{bbox}});
// Buildings missing housenumber
nwr["building"]["addr:housenumber"!"*"]({{bbox}});
// Buildings missing city
nwr["building"]["addr:city"!"*"]({{bbox}});
);
out body;
Buildings with minimal tags (likely satellite imports):
[out:json][timeout:30];
(
// Count all buildings and their tag completeness
nwr["building"]({{bbox}});
);
out body;
Output Format
After executing queries, present results in a structured format:
# Overpass Query Results
## Bounding Box
- South: X
- West: X
- North: X
- East: X
## Critical Infrastructure
### Hospitals/Healthcare
[Count: N]
[List with names and coordinates]
### Fire Stations
[Count: N]
[List with names and coordinates]
### Roads
[Count: N]
[Breakdown by type: residential, primary, secondary, etc.]
### Railways
[Count: N]
[Types: main lines, light rail, tram]
[... continue for each category]
## Buildings
### Large Offices
[Count: N]
### Population Indicators
[Total buildings: N]
[Building density analysis]
## Natural Objects
### Rivers
[Count: N]
### Lakes
[Count: N]
### Buildings Near Water
[Count: N]
## Data Quality
### Potentially Incomplete Data
[Buildings with missing names: N]
[Low coverage areas: description]
Error Handling
If the API returns an error:
- Check the bounding box format is correct
- Try with a smaller region
- Try individual queries instead of combined ones
- Report any API errors to the user
API Response Parsing
The JSON response has this structure:
{
"elements": [
{
"type": "node" | "way" | "relation",
"id": 12345,
"lat": 50.7,
"lon": 7.1,
"tags": {
"key": "value"
}
}
]
}
Extract elements array and parse type, lat, lon, and tags from each.