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.
1 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.
-
QGIS has styles for OSM data gis.stackexchange.com/questions/90086/…– Mapperz ♦Jun 22, 2016 at 15:37
-
-
You can export the style from QGIS see planet.qgis.org/planet/tag/style– Mapperz ♦Jun 22, 2016 at 15:51
-
Hi. This isn't quite the information that I'm looking for. I want to do this within Python. I want to use an API to get the data, not a web browser. I want to draw the map using basemap, which is a matplotlib extension. I'm not using PostgreSQL at all. I'm not using a GIS.– vy32Jun 23, 2016 at 16:58
-
Well, when you get the OSM data from the API you'll get a
*.osm
file with all data. Beyond this point I can't help you.– Magno CJun 24, 2016 at 1:26