skillfed

contextily

Context geo-tiles in Python

contextily v1.7.1 667.8K downloads/30d#5,418 on PyPI589
Permissive license BSD-3-Clause Active released

What it is and what it does

Contextily is a lightweight Python package that fetches map tiles from web services and integrates them into matplotlib visualizations or saves them as geospatial raster files. It abstracts away the complexity of tile coordinate systems, allowing you to work in either WGS84 (latitude/longitude) or Spheric Mercator (Web Mercator) projections. The package leverages xyzservices to provide access to popular tile providers including OpenStreetMap and Stamen Design variants.

Typically used in geospatial analysis workflows, contextily lets you quickly add geographic context to plots without managing tile URLs or coordinate transformations manually. It handles the download, caching, and reprojection of tiles, making it straightforward to create publication-ready maps with minimal code. The package is actively maintained and supports modern Python versions (3.10 and above).

Use it for:

  • Add OpenStreetMap or Stamen Design basemaps to matplotlib plots for geographic data visualization.
  • Export downloaded map tiles as GeoTIFF or other raster formats for offline use or further processing.
  • Quickly prototype geospatial analyses by overlaying vector data on contextual map imagery.
  • Create web-ready map visualizations by combining local geospatial datasets with standard tile providers.
  • Support coordinate system conversions between WGS84 and Web Mercator when working with tile-based services.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Contextily retrieves tile-based map imagery from the internet and overlays it as a basemap on matplotlib figures or exports it to geospatial raster files, supporting both WGS84 and Spheric Mercator coordinate systems.

Yes. Contextily is actively maintained, has no known vulnerabilities, low install friction, and solves a common need in geospatial Python workflows. If you work with matplotlib and geographic data and need quick access to map tiles, it is a straightforward, well-integrated choice.

Install

contextily on PyPI

pip

pip install contextily

uv

uv add contextily

poetry

poetry add contextily

Installing contextily

Before you install

Low friction: pure Python wheel, active maintenance (last commit 2026-07-27), and a straightforward dependency stack of well-established geospatial and visualization libraries. Requires Python 3.10 or above.

License in practice

BSD-3-Clause is permissive; you can use, modify, and distribute contextily with minimal restrictions in commercial or private projects.

Quickstart

pip install contextily

import contextily as ctx
import matplotlib.pyplot as plt

ax = plt.gca()
ctx.add_basemap(ax, crs='EPSG:3857')
plt.show()

Requires Python 3.10 or above; rasterio and pillow have optional compiled dependencies on some platforms.

Verify before relying

  • Whether xyzservices provider list is kept current and how often it is updated.
  • Performance characteristics when working with large geographic areas or high-resolution tiles.
  • Whether all Stamen Design tile variants (Toner, Terrain, Watercolor) remain available and stable.

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 8 — geopy, matplotlib, mercantile, pillow, rasterio, requests, joblib, xyzservices
Maintenance actively maintained — 35 days since the last release
Last repo commit
First released
Downloads 667,841/month — #5,418 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: contextily-1.7.1-py3-none-any.whl

Framework :: MatplotlibProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

tile basemap matplotlibopenstreetmap tiles pythongeospatial raster tilesmap tiles downloadcontextual map layersweb map tiles geospatialstamen tiles python
geospatialcartographyweb-tiles

More Scientific/Engineering packages