We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to read a PMTiles file from s3 using signed URLs
I expect this to allow the pmtiles to be read through leafmap and rendered, but instead I got a validation that the file path must ending .pmtiles.
import leafmap.foliumap as leafmap import boto3 s3_client = boto3.client('s3') signed_url = s3_client.generate_presigned_url( 'get_object', Params={'Bucket': myBucket, 'Key': "somePrefix/filename.pmtiles"}, ExpiresIn=60 * 60 * 4 # 4 hours ) m = leafmap.Map() m.add_pmtiles( signed_url, name="PMTiles", style=leafmap.pmtiles_style(signed_url), overlay=True, show=True, zoom_to_layer=True ) m
gives:
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) /tmp/ipykernel_128/88315447.py in ?() 1 import leafmap.foliumap as leafmap 2 3 m = leafmap.Map() 4 m.add_pmtiles( ----> 5 signed_url, name="PMTiles", style=leafmap.pmtiles_style(signed_url), overlay=True, show=True, zoom_to_layer=True 6 ) 7 m /opt/conda/lib/python3.10/site-packages/leafmap/common.py in ?(url, layers, cmap, n_class, opacity, circle_radius, line_width, attribution, **kwargs) 11640 palette = ["#" + c for c in get_palette(cmap, n_class)] 11641 11642 n_class = len(palette) 11643 > 11644 metadata = pmtiles_metadata(url) 11645 layer_names = metadata["layer_names"] 11646 11647 style = { /opt/conda/lib/python3.10/site-packages/leafmap/common.py in ?(input_file) 11549 ) 11550 return 11551 11552 if not input_file.endswith(".pmtiles"): > 11553 raise ValueError("Input file must be a .pmtiles file.") 11554 11555 header = pmtiles_header(input_file) 11556 metadata_offset = header["metadata_offset"] ValueError: Input file must be a .pmtiles file.
The text was updated successfully, but these errors were encountered:
my work around until we merge and release this:
signed_url = get_signed_url(s3_uri) + "&extension=.pmtiles"
Sorry, something went wrong.
Thanks for the fix. I will release a new version tonight
Fixed in v0.31.9
No branches or pull requests
Environment Information
Description
I am trying to read a PMTiles file from s3 using signed URLs
I expect this to allow the pmtiles to be read through leafmap and rendered, but instead I got a validation that the file path must ending .pmtiles.
What I Did
gives:
The text was updated successfully, but these errors were encountered: