Question methods and ways to export or query all hospitals from Open Street Map

Apr 30, 2020
How can I export or query all hospitals from Open Street Map and maintain the data in a postgresql-db for further analysis and steps...

'd like to extract all the hospital locations in the from Open Street Map as a reference for my ,little geocoding project. I know how to get all the OSM data for a small area with the QGIS plugin but not sure how to query a larger area eg for the whole planet-file?

some ideas:
1) The read-only Overpass API. I don't know that it'll work for the whole planet-file in one pass, but maybe if we extend the time out enough?
For a smaller area and with the benefit of a (minimal) UI, we can access Overpass via the XAPI Query Builder. There, we can put amenity=hospital in the tag search, select our area, and go.
2) Geofabrik downloads: filtered with Osmosis, as described in How to extract partial data for large regions? on the OpenStreetMap Help.
3.what about using regarding healthsites this is the most important link:
can i use for my project!?

what is aimed: i want to maintain the dataset in a pustgresql-db
update: since i am interested especially in the dataset of i can download it at this page:_

how do you think about this approach?!


You will need to experiment a bit.

How the hospital data (records, fields, types) is structured and presented (download) is important. For the most part you may need to do some additional filtering and/or parsing to obtain the required data.

I.e., you first download the data from the source, then select, sort, parse the data into a new table that fits your requirements. (Versus trying to do that via the download options (if any). However, if there are source site download options then they may simplify what you need to do with the data you download.

Try some controlled data downloads for a smaller geographic area. (There may be a filter that you can used for the initial download. For example the site download option may provide a menu where you can select location "X" where location is a country, state, city....

Especially a Location X where you already know what hospitals are there and where they are located.

Work on extracting the hospital locations from that data until you can get a match between your results and the previously identified "known" hospitals and Locations X.

Then use that algorithm to test a larger geographic area.

Most likely you will need to make modifications to your rules, filters, etc. to extract the hospital data.

Doubt that one rule will extract them all unless there is some common data value that identifies a "hospital". Could be an icon or some key word used on the maps.

The key is to be methodic and always have the ability to verify the results.

If you pull hospital data from two or more sources then compare results. My expectation would be that Dataset 1 and Dataset 2 will have overlapping data (Venn diagram) but each dataset will still have hospitals not found in the other.

The end requirement being able to merge the datasets to get the complete set of hospitals for the targeted geographical area.

As for tools: Python is quite powerful. May give you more overall control with regards to your requirements and what needs to be done to capture the hospital data.
Apr 30, 2020
hello again - great to hear from you .

i fully agree with your ideas. they sound convincing.

btw i am only interested in the POI - so i only need the records of the hospitals.
perhaps i can filter with osmfilter.

this will reduce the dataset.

see more specs of o approach <> OpenStreetMap

The data will flow both ways from to OpenStreetMap, and from OpenStreetMap to On the sign up to the page, users will register using OAuth against the OSM authentication provider. Each data change (create/update/delete) to a health facility on the platform will be written directly to the OSM database using the OSM API, with the OSM credentials associated with the logged in user on

Changes to health facility data made outside of the platform, and directly to OSM are replicated back in near-real time to a mirror of all health facility data found in OSM. This is achieved using docker-osm, developed by Kartoza which takes the high frequency diffs produced on OSM and applies them to a PostgreSQL / PostGIS database hosted on Changes made locally on are first pushed to OSM via the OSM API and then replicated back to our docker-osm instance using the same mechanism described above.

Our aim with this architectural approach is to make OSM the main storage location of all the health facility data available on and at the same time facilitate large queries, extracts and general innovation around the body of OSM health facility data, whilst having minimal impact and load on the services offered by OSM. The diagram below illustrates the high level architecture as pertains to interactions between OSM and

Data Model

The OSM data model put together for Healthsites was initially based off of several data models used in various HOT projects across South America, Africa and Southeast Asia. The initial list of tags was then compared to the data model that was already using to ensure that the same attributes were still being captured, but also offered some suggestions for additional key information that should be captured for health facilities. This was based on the numerous collaborations with HOT project partners over the years and their data needs.

The overall idea is to use existing OSM tags where possible and only propose new tags where necessary. A lot of research went into the development of the Healthsites OSM data model, including the review of existing HOT data models and OSM data models available on the OSM wiki. Verification of the tags usage through the OSM wiki, Tag Info and Tag History, with further analysis on tags using OSMFilter for certain areas of interest, helped identify values generally applied in a local area.
what about to take - to a first source that i use!=?


Two part project:

1) "The data will flow .... from to OpenStreetMap"

2) Then "OpenStreetMap to "

Not sure abut "to a first source that I use" - do you mean the first step in processing the data to fit your requirements?

Provided that I am following things correctly my suggestion is to just try it.

Determine what works and what does not work.

I.e., download the data to a file. What format is the data: csv, txt, xls, or fixed field?

Hopefully you can work with that imported data directly and not need to change the format. The fewer the steps the better. Simplicity.

Once you know the data fields and formats then you can use/apply your database tools to further refine the data to meet your requirements.

Getting/importing data from multiple sources is always problematic. It does help if all of the sources are adhering to some strict/standardized format. Your/the data model.

However, there could be some change on a data source end that un-does your efforts. You fix it on your end but then the other data imports may not work.

Overall, sketch the data flows all out step by step. Keep the steps simple. Develop a plan and then work through each step to manipulate the data per the requirements.

Project Part 1 first, then Project Part 2 second.

Importing data from a source does not risk the original data. However once you start exporting data back then the risks are much higher to the original data: You need much more protection to avoid data corruption, invalid data, human errors, and so forth.

Security and backups.

Focus on achieving a working manual process first then automate when viable. Make it work, then make it "pretty".
Apr 30, 2020
hello and good day - many thanks for the reply.

btw: when trying to get the data from overpass-turbo i get somewhat full set of POI data

[out:csv(::id,::type,"name","addr:postcode","addr:city","addr:street","addr:housenumber","website"," contact:email=*")][timeout:600];
( node(area.a)[amenity=hospital];
see the results:

@id    @type    name    addr:postcode    addr:city    addr:street    addr:housenumber    website     contact:email=*

2656877    relation    Unfallkrankenhaus Lorenz Böhler    1200    Wien    Donaueschingenstraße    13   
2685003    relation    Landeskrankenhaus Hörgas-Enzenbach                    [url=][/url]   
2685004    relation    Landeskrankenhaus Judenburg-Knittelfeld                    [url=][/url]   
2685005    relation    Landeskrankenhaus Hochsteiermark                    [url=][/url]   
2685006    relation    Landeskrankenhaus Mürzzuschlag-Mariazell                    [url=][/url]   
2685007    relation    Landeskrankenhaus Rottenmann-Bad Aussee                    [url=][/url]   
2755244    relation    Landesklinikum Scheibbs    3270    Scheibbs    Feldgasse    26       
2764083    relation    Allgemeines Krankenhaus Wien    1090    Wien    Währinger Gürtel    18-20    [url=][/url]   
2882269    relation    Unfallkrankenhaus Salzburg                    [url=][/url]   
3333391    relation    Krankenhaus St. Josef    5280    Braunau am Inn    Ringstraße    60   
4460484    relation    Landeskrankenhaus Graz II                    [url=][/url]   
6704364    relation    Landesklinikum Neunkirchen            Peischingerstraße    19   
9522773    relation    Krankenhaus der Barmherzigen Brüder    7000    Eisenstadt    Esterhazystraße    26       
11077211    relation    "Landeskrankenhaus Murtal, Standort Stolzalpe Haus 1"    8852    Stolzalpe    Stolzalpe    38
if you look here - this is much much more incomplete!/locality/node/4777740642

no complete adress - no website etc. etx.

conclusio: should i stick to a request with - is this more appropiate?!