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

minNativeZoom: 0 and minZoom: negative int results in Uncaught Error: Attempted to load an infinite number of tiles #28

Closed
jopfre opened this issue Dec 19, 2018 · 1 comment

Comments

@jopfre
Copy link

jopfre commented Dec 19, 2018

When minNativeZoom: 0 and a negative minZoom value are set on the tile layer, zooming out results in Uncaught Error: Attempted to load an infinite number of tiles

To reproduce set options as follows in OSOpenSpace.js:

options = L.extend({
        crs: L.OSOpenSpace.CRS,
        tileSize: 200,
        minNativeZoom: 0,
        maxNativeZoom: 0,
        maxZoom: 0,
        minZoom: -2
}, options);`

Here are two minimal tests to show the issue.
os-leaflet
https://5amc.cf/test/os.html

open street maps with the same options passed scales the zoom level 0 tiles as expected.
https://5amc.cf/test/l.html

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
		  minNativeZoom: 0,
		  maxNativeZoom: 0,
		  maxZoom: 0,
		  minZoom: -2
	}).addTo(map);

Any ideas what might be the cause? I'm happy to investigate but would appreciate pointers if you have any.

@jopfre
Copy link
Author

jopfre commented Dec 20, 2018

The issue is actually to do with proj4leaflet, so I will close.

For those curious this post explains a bit kartena/Proj4Leaflet#144 (comment)

Essentially leaflet's default projection uses a scale factor rather than resolutions like proj4leaflet so can scale to arbitrary zoom levels.

In proj4leaflet each zoom level (resolution) must be defined first. So the solution in this case was to define an "imaginary" resolution in new L.Proj.CRS() and then set the minNativeZoom to a "real"resolution in L.OSOpenSpace.TileLayer options.

@jopfre jopfre closed this as completed Dec 20, 2018
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