OpenStreetMap (OSM)
OpenStreetMap (OSM) is a free, open geographic database updated and maintained by a community of volunteers via open collaboration. OSM has Overpass API, a read-only API access for fetching and saving raw geodata from its database.
Links to OpenStreetMap (OSM):
Overpass API: https://overpass-api.de/
Folium
`folium` builds on the data wrangling strengths of the Python ecosystem and the mapping strength of the `leaflet.js` library. Manipulate data with Python, then visualize it on a Leaflet map via `folium`.
Links to `folium`:
For this project, I collected data of medical facilities (hospital, clinic, doctor, dentist, and pharmacy) in Bali Province, Indonesia. The data contained 4 attributes: name of the medical facility, type, and coordinates in latitude and longitude. The scraped data was then saved in a csv file and then displayed in simple map page.
Area of Interest
Visualize the area of interest: Bali Province, Indonesia.
Scraping data from OpenStreetMap (OSM)
Searching in OpenStreetMap with keyword `hospital in Bali` will give result like shown below:
Python Code
Libraries
For scraping the data, I used 3 Python libraries:
pandas for manipulating and analyzing data,
requests to make and process HTTP requests,
json to parse JSON into dictionary or list.
API
Link to OpenStreetMap (OSM) Overpass API: http://overpass-api.de/api/interpreter.
 Query
Query for searching medical-facilities in Bali, Indonesia:
[out:json];
(area['name:id'='Provinsi Bali'];
node[amenity~'(clinic|dentist|doctors|hospital|pharmacy)'](area);
);
out;
Jupyter Notebook Files
The Python codes for this project is in Jupyter Notebook format and available in my Github page.
Link to code for scraping data: scraping_data.ipynb
Link to code for visualization:Â folium_visualization.ipynb
Output
There are 2 outputs from this project:
CSV file contains data of medical facilities in Bali
HTML map of medical facilities data in Bali.
There are 5 kinds of medical facilities in this map:
clinic (in purple color)
dentist (green)
doctor (blue)
hospital (red)
pharmacy (orange)
To show data for each medical facility, click Layer icon in top-right corner of the map, then select medical facility name.Â
By default, the map will show data for all medical facilities. To hide other medical facilities from map, simply deselect the medical facility name in the list.
To zoom in and zoom out the map, use sign + and - in top-left corner.
Link to github repository