Tile Providers

mappyng.tile.TILE_PROVIDERS = dict, alias to XYZ URL template

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

Built-in aliases:

  • OpenStreetMap: "openstreetmap" / "osm"

  • CartoDB: "cartodb_positron" / "positron", "cartodb_darkmatter" / "darkmatter", "cartodb_voyager" / "voyager"

  • Stadia / Stamen: "terrain", "toner", "watercolor"

  • ESRI: "satellite" / "esri_worldimagery", "esri_worldstreet", "esri_natgeo", "esri_ocean"

  • OpenTopoMap: "opentopomap" / "topo"

class mappyng.tile.TileConfig(source='cartodb_positron', zoom='auto', zoom_offset=0, opacity=1.0, z_order=-5, timeout=10.0, cache=True, cache_dir=None, on_cartouches=True, on_zoom=True, max_tiles=64, warp_scale=1.5, extra_zoom_levels=0)[source]

Bases: object

Configuration for a tile layer.

Parameters:
  • source (str) – Provider alias (e.g. "cartodb_positron") or a URL template with {x}, {y}, {z} placeholders.

  • zoom (int or "auto") – Zoom level or "auto" (calculated from bbox + map width).

  • zoom_offset (int) – Added to the auto-calculated zoom (e.g. -1 for lighter tiles).

  • opacity (float) – Tile layer opacity (0-1).

  • z_order (int) – SVG z-order of the tile layer (default below basemap).

  • timeout (float) – HTTP request timeout in seconds.

  • cache (bool) – Whether to use disk cache (default True).

  • cache_dir (str or None) – Cache directory. Defaults to ~/.cache/mappyng/tiles.

  • on_cartouches (bool) – Render on cartouche viewports (default True).

  • on_zoom (bool) – Render on zoom viewport (default True).

  • max_tiles (int) – Safety limit on the number of tiles downloaded per viewport.

  • warp_scale (float) – Resolution of the warped output image relative to the SVG content area (default 1.5, 50 % denser than screen pixels for crispness).

__init__(source='cartodb_positron', zoom='auto', zoom_offset=0, opacity=1.0, z_order=-5, timeout=10.0, cache=True, cache_dir=None, on_cartouches=True, on_zoom=True, max_tiles=64, warp_scale=1.5, extra_zoom_levels=0)
cache: bool = True
cache_dir: str | None = None
extra_zoom_levels: int = 0

Number of coarser zoom levels to also fetch (0 = target zoom only). Levels are composited from coarsest to finest: finer tiles overwrite coarser ones where they exist, coarser ones fill gaps where finer tiles failed to download. E.g. extra_zoom_levels=3 fetches at zoom, zoom-1, zoom-2, zoom-3 and composites them.

max_tiles: int = 64
on_cartouches: bool = True
on_zoom: bool = True
opacity: float = 1.0
source: str = 'cartodb_positron'
timeout: float = 10.0
warp_scale: float = 1.5
z_order: int = -5
zoom: object = 'auto'
zoom_offset: int = 0