[GIS] Get map from OpenStreetMap and use it as a background with basemap

matplotlib-basemapopenstreetmap

I want to take a bounding box, use the OpenStreetMap API and get a tile, then use it as a background in basemap. This should be easy, but I haven't been able to figure out the API.

Best Answer

Go to OSM website (http://www.openstreetmap.org), choose a BBOX and select export.

When you take data from OSM you'll get just the data. You'll need to import it to your database/QGIS/Geoserver and apply some styles to see the data as seen in OSM map. I know nothing about matplotlib-basemap.

To import the data to PostgreSQL you can use osm2pgsql:

osm2pgsql -C 2500 -c -d database_target -U postgre_user -W -s -S ./your_style_file.style your_osm_file.osm

Your database_target must have the GIS extensions.

Getting the same beautiful OSM map appearance is not so easy since there is no official style file to download. You must dig it.