Skip to content

Rendering PC vector tiles with ipyleaflet/leafmap #175

Answered by TomAugspurger
giswqs asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks @giswqs. I think that this should work for you:

import leafmap
m = leafmap.Map()
url = "https://planetarycomputer.microsoft.com/api/data/v1/vector/collections/ms-buildings/tilesets/global-footprints/tiles/{z}/{x}/{y}"
attribution = "Microsoft"
vector_tile_layer_styles = {}
m.add_vector_tile_layer(url, attribution, vector_tile_layer_styles)
m

For this specific dataset, the tiles are a collection-level asset. You can get that URL programatically with

import requests
import pystac_client

catalog = pystac_client.Client.open("https://planetarycomputer.microsoft.com/api/stac/v1/")

asset_href = catalog.get_collection("ms-buildings").assets["global-footprints"].href
url = requests.get(a…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by giswqs
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants