mercantile
Web mercator XYZ tile utilities
Decision gist · record as of 2026-08-14
Yes. Mercantile is a stable, well-maintained library with no known vulnerabilities, minimal dependencies, and a clear purpose. It's the standard choice for Web Mercator tile math in Python. Install it if you're working with tile-based maps or need to convert between geographic and tile coordinate systems.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with a single lightweight runtime dependency (click).
- Repository is active with a recent commit (2026-06-29) and has been maintained since its 2014 release.
License · maintenance · safety
BSD (permissive) — BSD license is permissive; you can use, modify, and distribute this package with minimal restrictions, provided you include the license notice.
last release 2021-04-21 (1941 days) · last repo commit 2026-06-29 · 453 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,239,491 downloads/mo, #3,193 on PyPI
Alternatives
Verify before relying
pip install mercantile
import mercantile
# Get upper-left corner of a tile
ul = mercantile.ul(486, 332, 10)
print(ul) # LngLat(lng=-9.140625, lat=53.33087298301705)
# Get bounding box of a tile
bounds = mercantile.bounds(486, 332, 10)
print(bounds)- Whether the package actively supports Python 3.10+ or only legacy versions (classifiers list Python 2.7 and generic Python 3, but latest release was 2021-04-21)
What it is and what it does
Mercantile is a utility library for working with Web Mercator tiles—the standard XYZ grid system used by web mapping platforms. It provides functions to convert between geographic coordinates (longitude/latitude), spherical Mercator coordinates, and tile indices at various zoom levels. It also handles quadkey encoding (Microsoft's tile naming scheme) and lets you traverse tile hierarchies by finding parent and child tiles.
The library is primarily used by GIS developers, map tile servers, and geospatial analysis tools. It includes both a Python API with named tuples for tiles and bounding boxes, and a command-line interface (via click) for batch operations like generating GeoJSON tile shapes or finding tiles that overlap a given region. The package has been stable since 2014 and sees consistent use in the geospatial ecosystem.
Use it for
- Convert geographic coordinates to tile indices for web map tile servers or slippy map implementations.
- Generate GeoJSON representations of Web Mercator tiles for visualization or analysis.
- Find which tiles intersect a bounding box or geographic region.
- Navigate tile hierarchies to zoom in/out or find neighboring tiles.
- Encode/decode quadkeys for tile identification in mapping APIs.
- Build command-line tools for tile processing using the mercantile CLI.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Mercantile is a stable, well-maintained library with no known vulnerabilities, minimal dependencies, and a clear purpose. It's the standard choice for Web Mercator tile math in Python. Install it if you're working with tile-based maps or need to convert between geographic and tile coordinate systems.
Install
mercantile on PyPI
Before you install
Low friction: pure Python wheel with a single lightweight runtime dependency (click). Repository is active with a recent commit (2026-06-29) and has been maintained since its 2014 release.
License in practice
BSD license is permissive; you can use, modify, and distribute this package with minimal restrictions, provided you include the license notice.
Quickstart
pip install mercantile
import mercantile
# Get upper-left corner of a tile
ul = mercantile.ul(486, 332, 10)
print(ul) # LngLat(lng=-9.140625, lat=53.33087298301705)
# Get bounding box of a tile
bounds = mercantile.bounds(486, 332, 10)
print(bounds)
Verify before relying
- Whether the package actively supports Python 3.10+ or only legacy versions (classifiers list Python 2.7 and generic Python 3, but latest release was 2021-04-21)
Package facts
| License | BSD permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageclick |
| Maintenance | Actively maintained 1,941 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,239,491 / month, #3,193 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 2.7Programming Language :: Python :: 3Topic :: Scientific/Engineering :: GIS |
Evidence: mercantile-1.2.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “xyz tile utilities”
- mercantileMercantile converts between geographic coordinates, Web Mercator…
- xyzservicesProvides a Python API and JSON database of XYZ tile service providers…
- supermorecadoExtends morecantile with command-line and Python tools to burn…
Give your agent the search over MCP, or paste the wish link into any chat.
More GIS packages
Shapely provides Python tools for creating, manipulating, and analyzing 2D geometric objects (points, lines, polygons) using the GEOS library, with both scalar and vectorized NumPy-based operations.
pyproj provides a Python interface to PROJ, enabling cartographic projections and coordinate system transformations for geospatial applications.
GeoPandas extends pandas DataFrames to handle geographic data, combining pandas operations with shapely geometry and spatial analysis capabilities that would otherwise require a spatial database.
Install it if you work with geographic data in Python and want to avoid setting up a spatial database or learning a separate GIS tool.
geopy is a Python client for geocoding and distance calculation that converts addresses to coordinates and vice versa using multiple web-based geocoding services, and computes geodesic and great-circle distances between geographic points.
Install it if you need geocoding or distance calculations in your application.
Pyogrio provides fast, bulk-oriented read and write access to vector spatial data formats (Shapefile, GeoPackage, GeoJSON, etc.) via GDAL/OGR bindings, typically for use with GeoPandas GeoDataFrames.
h3 provides Python bindings to Uber's H3 geospatial indexing library, converting geographic coordinates into hierarchical hexagonal grid cells and performing spatial operations on them.
See also pyGeoTile · morecantile · contextily · supermorecado · xyzservices · mapbox-vector-tile · polyline · tzfpy · staticmap · pygeohash