Skip to content

Instantly share code, notes, and snippets.

@darribas
Last active November 3, 2017 16:41
Show Gist options
  • Save darribas/9907cc32fa130dd886a7fa0f04ce9b76 to your computer and use it in GitHub Desktop.
Save darribas/9907cc32fa130dd886a7fa0f04ce9b76 to your computer and use it in GitHub Desktop.
Contextily Release 0.99.0

Earlier this month, and with the great help of Chris Holdgraf and Filipe Fernandes, we pushed a new release of contextily, the Python library to pull web tiles from the internet that can be used as contextual maps.

Besides a few bug fixes, the main addition in this release is the Places API that Chris included. This is a super handy way to quickly pull down a tile for an area. Let's see a quick example!

Say you are working with a spatial dataset around the Berkley campus and you would like to add some context to your data points. All you need to do is:

import contextily as ctx
bkl = ctx.Place("UC Berkeley")

And you can quickly plot it with the newly added plot_map function:

ctx.plot_map(bkl)

berkeley

Voila! You're done. Same as with any other contextily object, since it is all based on matplotlib, tiles are treated as images and the bounds are returned, so you can integrate them with any other geo-data you are working with in Python, say by using geopandas or PySAL. We have also updated the main guide notebook so be sure to check it out to find out all that is possible with the new contextily.

You can install or upgrade contextily using pip:

pip install -U contextily

or conda (using the conda-forge channel):

conda install -c conda-forge contextily

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment