Skip to content
New issue

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

Fix/handle-out-of-bounds-tiles #352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

cr3a7ure
Copy link

@cr3a7ure cr3a7ure commented Feb 13, 2024

  • Do not throw exception on tile fetch when response status is 400
  • 400 on OpenStreetMaps and GeoServer means that you are out of bounds
  • Thus allowing to count correctly the retrieved tiles and fire saveend

This is a common scenario when retrieving tiles beyond zoom level 19 on openstreetmaps and from other servers too.
I followed the least changes approach.
The saved blob, does not get rendered from leaflet. We can also return a null sized image blob.

Thanks for the time to review it.

* Do not throw exception on tile fetch when response status is 400
* 400 on OpenStreetMaps and GeoServer means that you are out of bounds
* Thus allowing to count correctly the retrieved tiles and fire saveend
@allartk
Copy link
Owner

allartk commented Feb 14, 2024

Hi, thanks for the pull request!

I wonder, can you prevent those download attempts be configuring bounds and zooms of the layer?

@cr3a7ure
Copy link
Author

I have not studied your code in more depth TBH, but I believe it will require more logic for sure.
Especially if you had in mind the base layer which covers most of the times the whole map.
I am serving custom geoTIFF overlays as WMTS layers which means that they are oddly shaped.
I cannot suggest a universal way to retrieve bounds/zoom/layer.

On my scenario, I retrieve the bounds of the layer via WMS Info calls on GeoServer, I set those in the extent of the leaflet map and then proceed to use saveTiles on those bounds.

For compatibility reasons and stability we could use a flag in options to allow those 400s be counted towards saveend event.
I have deployed the change and monitoring the user experience.

Thanks for jumping in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants