opengeos / leafmap

A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment
https://leafmap.org
MIT License
3.22k stars 386 forks source link

74_map_tiles_to_geotiff.ipynb #540

Closed sandorkonya closed 1 year ago

sandorkonya commented 1 year ago

Environment Information

https://leafmap.org/notebooks/74_map_tiles_to_geotiff/ - opened on colab

Description

got error by running the notebook and using OSM as basemap.

What I Did

added a bbox on the map: [1.909, 47.9013, 1.9118, 47.9024] changed the source basemap (to default == OSM)

image

HTTPError                                 Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/leafmap/common.py](https://localhost:8080/#) in map_tiles_to_geotiff(output, bbox, zoom, resolution, source, crs, to_cog, quiet, **kwargs)
   9317     try:
-> 9318         draw_tile(source, south, west, north, east, zoom, output, quiet, **kwargs)
   9319         if crs.upper() != "EPSG:3857":

7 frames
HTTPError: 403 Client Error: Forbidden for url: https://tile.openstreetmap.org/15/16557/11403.png

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/leafmap/common.py](https://localhost:8080/#) in map_tiles_to_geotiff(output, bbox, zoom, resolution, source, crs, to_cog, quiet, **kwargs)
   9322             image_to_cog(output, output)
   9323     except Exception as e:
-> 9324         raise Exception(e)
   9325 
   9326 

Exception: 403 Client Error: Forbidden for url: https://tile.openstreetmap.org/15/16557/11403.png
giswqs commented 1 year ago

The OpenStreetMap example has been removed. Please check the updated version. https://leafmap.org/notebooks/74_map_tiles_to_geotiff/

sandorkonya commented 1 year ago

Thank you,

after reviewing the original repo, probably a session header would solve the error.

@edit: i tried with a session header, but still getting 403 error.

regards!

giswqs commented 1 year ago

Good suggestion. I did not realize that I missed the session header. It worked before without it. Not sure why it stopped working suddenly. I have added the session header in #541. You can run geemap.update_package() and restart the kernel to take effect.