-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Remove hardcoded world size from L.TileLayer #2160
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
Conversation
| _getWrapTileNum: function () { | ||
| // TODO refactor, limit is not valid for non-standard projections | ||
| return Math.pow(2, this._getZoomForUrl()); | ||
| _getWrapTileNum: function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix whitespace here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry. Fixed.
|
That's a really nice way to remove the hardcode! I'll merge this for 0.7. |
Remove hardcoded world size from L.TileLayer
|
Patched up |
|
Yes, sorry! |
|
No problem, thanks a lot for the pull :) Feel free to check out other projection-related hardcodes in Leaflet codebase or any ways to improve the projections code and send suggestions/pull requests. |
This moves the parts hardcoded for spherical Mercator from L.TileLayer into L.CRS, where they can be overridden more easily.
In particular, this makes it possible to use TMS with L.TileLayer with projections other than spherical Mercator, which isn't possible today. (Proj4Leaflet currently has a pretty nasty workaround for this, which would be nice to get rid off.)
To do this, the method
getSizeis added to ICRS, which returns the size of the entire CRS in pixels, for a given zoom level. This is in turn used in L.TileLayer to calculate the the proper tile number for wrapping and TMS.