1

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

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 '16 at 15:37
  • Whoa! Good to know. Can I use them in Geoserver? – Magno C Jun 22 '16 at 15:39
  • You can export the style from QGIS see planet.qgis.org/planet/tag/style – Mapperz Jun 22 '16 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. – vy32 Jun 23 '16 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 C Jun 24 '16 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.