OpenStreetMap (OSM) is a free, open geographic database updated and maintained by a community of volunteers via open collaboration. Contributors collect data from surveys, trace from aerial imagery and also import from other freely licensed geodata sources.
Link to OpenStreetMap: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
.
Link to folium
:
In this repository, I collect data of medical facilities (hospital, clinic, doctor, dentist, and pharmacy) in Bali province, Indonesia. The data contains 4 atrributes: name of the medical facility, type, and coordinates in latitude and longitude. The scraped data is saved in a csv file and then displayed in simple html page.
Visualize the area of interest with library folium
:
If we search keyword "hospital in Bali"
in OpenStreetMap, the result will be like this:
Here, I will collect data of medical facilities consisting clinics, dentists, doctors, hospitals, and pharmacies.
I use 3 libraries for scraping data:
pandas
for manipulating and analyzing data,requests
to make and process HTTP requests,json
to parse JSON into dictionary or list.
API link for OpenStreetMap: http://overpass-api.de/api/interpreter
Query for searching medical-facilities in Bali, Indonesia:
[out:json];
(area['name:id'='Provinsi Bali'];
node[amenity~'(clinic|dentist|doctors|hospital|pharmacy)'](area);
);
out;
There are 2 output files from this project:
- A CSV file contains data of medical facilities in Bali.
- An HTML page contains map for visualizing the data.
Since github can't render html page correctly, I put the final output of this code in my blog here.