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

Incorrect _tileforSave.length value with zoomOffset #402

Open
George-Madeley opened this issue Oct 8, 2024 · 0 comments
Open

Incorrect _tileforSave.length value with zoomOffset #402

George-Madeley opened this issue Oct 8, 2024 · 0 comments

Comments

@George-Madeley
Copy link
Contributor

I am creating a React application which allows the users to download map tiles at the selected zoom level of their choice. They can select their zoom level from a drop down menu (defaults to 10). When they click download, a modal appears asking for them to confirm if they want to download x many tiles. This is very similar to this example. However, the number of tiles that appears is incorrect. The number that appears instead is the number of tiles for the previous zoom level.

i.e., if a user selected zoom level 9 and clicked download. The form would appear asking if they wished to download 20 tiles. After confirming, only 9 tiles are downloaded (This is confirmed by looking in devtools > application > IndexedDB > leaflet.offline > tileStore) which is the number of tiles are the modal displays when the user selects a zoom level of 8 (but of course, only . What is interesting is the actual number of tiles that is downloaded 4 tiles are actually download).

What makes this more interesting is the number of tiles that are actually downloaded (i.e., 9 for zoom level 9 and 4 for zoom level 8) are correct. I have confirmed this by force the map to only use downloaded tiles and then console logged the current zoom level and the tiles do appear at zoom level 9 and 8 respectfully and are within the bounds of the viewport.

I do believe I have the cause for this issue. The tile provider I am using does not display correctly unless the zoomOffset is set to -1. I believe the zoomOffset from TileLayerOptions is not fully integrated into the _calculateTiles() method in ControlSaveTiles.

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

No branches or pull requests

1 participant