Being someone who never worked with map / geo data before, it’s quite a challenge for me at first. My objective was to play around with maps, its coordinate system, and maybe to apply some clustering / prediction model on top of it later on, producing some useful insights.
Anyawy, to start, I want to be able to draw an interactive and beautiful map. Below are the steps I’ve taken:
- Preparation: download geojson map data and install a few Python libraries
Map data can be downloaded at: mapzen/metro-extracts
Note: For this tutorial, make sure you download the map in imposm-geojson
format.
- Bring it all together with Python
Import libraries and read Singapore map data:
At this stage, you can already plot it:
However, the map should only contain Singapore data, you can implement its boundary with the admin.geojson
file:
Our map now contain only Singapore data:
However, the map still doesn’t look good nor interactive yet. We’re going to solve it with mplleaflet
:
- End result
Note: You can also then view it live at: singapore-roads.html