Hospitals are mostly mapped as areas covering the site, sometimes as multipolygon relations. nwr with out center turns them all into one point each.
The query
[out:json][timeout:60]; area["ISO3166-1"="IE"][admin_level=2]->.ie; nwr["amenity"="hospital"](area.ie); out center;
Run it
Live result from overpass.ch, cached for up to 12 hours. Map data © OpenStreetMap contributors (ODbL).
How it works
- Hospitals are rarely single nodes; most results are ways and relations.
- Use
out geom;instead ofout center;to get the site outlines.
Variations
- Emergency departments: add
["emergency"="yes"]. - Clinics and doctors are
amenity=clinicandamenity=doctors.
Run it from your code
curl https://api.overpass.ch/v1/YOUR_API_KEY/interpreter \
--data-urlencode 'data@query.overpassql'
import requests
query = open("query.overpassql").read()
r = requests.post("https://api.overpass.ch/v1/YOUR_API_KEY/interpreter",
data={"data": query}, timeout=120)
r.raise_for_status()
print(r.json()["elements"][:3])
const res = await fetch("https://api.overpass.ch/v1/YOUR_API_KEY/interpreter", {
method: "POST",
body: new URLSearchParams({ data: query }),
});
if (!res.ok) throw new Error(await res.text());
console.log(await res.json());
Save the query as query.overpassql. It works the same in Overpass Turbo, QGIS and JOSM.