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

TMS doesn't work with L.CRS.Simple in 1.0 #4338

Closed
hyperknot opened this issue Mar 21, 2016 · 6 comments
Closed

TMS doesn't work with L.CRS.Simple in 1.0 #4338

hyperknot opened this issue Mar 21, 2016 · 6 comments
Labels

Comments

@hyperknot
Copy link
Collaborator

As provided by a user in #4333 using L.CRS.Simple with tms: true results in an exception where this._globalTileRange is uninitialised in tileLayer / getTileUrl.

getTileUrl: function (coords) {

http://playground-leaflet.rhcloud.com/jac/1/edit?html,output

It works untouched in 0.7, but is broken in 1.0

Related issue: #2298

cc: @perliedman

@perliedman
Copy link
Member

The problem is that L.CRS.Simple is an so called "infinite" CRS (https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Simple.js#L24), which means it does not have any bounds.

TMS, on the other hand, needs an upper bound for the CRS's Y coordinate, to be able to flip the tile row.

This means that TMS will not work with L.CRS.Simple out of the box in 1.0. On the other hand, the only reason it worked in 0.7 was that L.CRS.Simple had implicit bounds, and from what I remember a lot of people ran into weird problems because those implicit bounds were rarely the same as the actual limits.

If you want to use TMS and a CRS that resembles L.CRS.Simple, you should extend it, set infinite: false and give it the bounds you want. This could, of course, be made clearer with a tutorial or some kind of warning in the docs.

@jieter
Copy link
Contributor

jieter commented Mar 22, 2016

Regarding #4337, should we not try to replace {-y} if map.crs.infinite === true to prevent this error ?

@perliedman
Copy link
Member

@jieter yes, sounds like a good plan. In general it would of course be very nice to provide a better error message than that some internal variable is undefined!

@balciseri
Copy link

Yes at the moment if i reference the master version with the {-y} fix i can't use crs: L.CRS.Simple,
because it will not work.

@jieter
Copy link
Contributor

jieter commented Mar 22, 2016

Hang on, working on it...

@jieter
Copy link
Contributor

jieter commented Mar 22, 2016

@perliedman Leaflet doesn't seem to do much explaining in error messages. I've added an example of the error produced by a small L.CRS.Simple-example to the description of #4344 .

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

No branches or pull requests

4 participants