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 logic for determining when to map lods #1051

Merged
merged 1 commit into from
Feb 15, 2018
Merged

Conversation

jgravois
Copy link
Contributor

i made a serious logic error in #1045

we should only be attempting to remap LODs when the CRS of the map is web mercator and the LODs roughly match the convention

for WGS84 tiled services and applications with an appropriately defined custom CRS (using Proj4) that matches the service, we should do nothing.

we should only log a warning to the console when neither of the above are true.

cc/ @theashyster

@jgravois jgravois merged commit c4ea549 into master Feb 15, 2018
@jgravois jgravois deleted the patch1019-for-real branch February 15, 2018 21:27
@@ -140,7 +140,10 @@ export var TiledMapLayer = TileLayer.extend({
}

this.fire('lodmap');
} else if (map.options.crs && map.options.crs.code && (map.options.crs.code.indexOf(sr) > -1) || (map.options.crs === CRS.EPSG4326 && (sr === 4326))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think the second part is actually redundant here.
I looked at CRS.EPSG4326 here https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG4326.js#L20 and it also contains code attribute, so the code would go in the else if block already after the first check that is map.options.crs && map.options.crs.code && (map.options.crs.code.indexOf(sr) > -1)

So at the end it looks to me that this else if block could be simplified to this
} else if (map.options.crs && map.options.crs.code && map.options.crs.code.indexOf(sr) > -1) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

jgravois added a commit to jgravois/esri-leaflet that referenced this pull request Apr 23, 2022
fix logic for determining when to map lods
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.

2 participants