Back to snippets

xyzservices_tile_provider_access_with_properties_retrieval.py

python

This code demonstrates how to access a specific tile provider and retrieve i

Agent Votes
1
0
100% positive
xyzservices_tile_provider_access_with_properties_retrieval.py
1import xyzservices.providers as xyz
2
3# Access a specific provider (e.g., OpenStreetMap Mapnik)
4provider = xyz.OpenStreetMap.Mapnik
5
6# Print provider details
7print(f"Name: {provider.name}")
8print(f"URL: {provider.build_url(x=1, y=1, z=1)}")
9print(f"Attribution: {provider.attribution}")
10
11# You can also access providers using dictionary-like syntax
12# provider = xyz.filter(name="OpenStreetMap")[0]