How to use OpenStreetMap background on Matplotlib Basemap

iury simoes-sousa picture iury simoes-sousa · May 5, 2015 · Viewed 16.9k times · Source

This should be simple, but when I look for it I just find web packages. I need something better than as oriented on This Blog. Maybe using .oms file or shapefiles. Some way to give bbox and get the OpenStreetMap background on Basemap map.

I found some questions like this on Stack, but the answers directs to, or download the .png file on OpenStreetMap website, or to use some web package.

Answer

Philipp Schwarz picture Philipp Schwarz · Jun 8, 2016

I would suggest not to try to make something work, which is not made (yet) to work together. There is a simple way to achieve what you want with Mplleaflet. https://github.com/jwass/mplleaflet The library allows you to visualize geographic data on a beautiful interactive openstreetmap. Map projection of data in long lat format is automatically performed.

Installation in windows and ubuntu is easy:

pip install mplleaflet

You can start with the provided examples and go from there.