XYZ Services Tiles Providers
xyzservices provides a comprehensive collection of XYZ tile providers for mapping applications, offering easy access to various base maps and overlays. It helps users integrate tile services into geospatial libraries like Folium, Leaflet, and Contextily. The current version is 2026.3.0, and it maintains a rapid release cadence, typically monthly or bi-monthly, to reflect changes in upstream tile providers.
Warnings
- breaking Stamen tile providers have been removed due to upstream deprecation. Direct usage of `xyz.Stamen.*` will fail.
- breaking HERE API v2 has been removed, and the `HEREv3` provider has been renamed to `HERE`. Users relying on older HERE services will experience broken functionality.
- gotcha Many providers, particularly those from smaller or experimental services, can become broken or change URLs without notice. This can lead to `KeyError` if a provider is removed, or broken maps if the URL changes.
- gotcha Providers requiring API keys (e.g., MapTiler, ThunderForest, HERE) will fail if the key is missing or incorrectly formatted. The `.format()` method is used to inject keys into the URL.
Install
-
pip install xyzservices
Imports
- providers
import xyzservices.providers as xyz
- TileProvider
from xyzservices import TileProvider
Quickstart
import xyzservices.providers as xyz
# Access a common, free-to-use provider
provider = xyz.CartoDB.Positron
print(f"Provider Name: {provider.name}")
print(f"URL Template: {provider.url}")
print(f"Attribution: {provider.attribution}")
print(f"Minimum Zoom: {provider.min_zoom}, Maximum Zoom: {provider.max_zoom}")
# Example of a provider that often requires an API key
# API_KEY = os.environ.get('MAPTILER_API_KEY', '')
# if API_KEY:
# maptiler_provider = xyz.MapTiler.Basic.format(apiKey=API_KEY)
# print(f"\nMapTiler Basic URL (with key): {maptiler_provider.url}")
# else:
# print("\nNote: MAPTILER_API_KEY environment variable not set. MapTiler providers often require an API key.")