merge patch from #491, that updates things to getThinnedEntitiesV4

also a couple of plugins that were missed
This commit is contained in:
Jon Atkins
2013-08-16 17:36:17 +01:00
parent 7d8e583273
commit 92433c5d4b
5 changed files with 12 additions and 12 deletions

View File

@ -10,20 +10,20 @@
// http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
window.lngToTile = function(lng, zoom) {
return Math.floor((lng + 180) / 360 * Math.pow(2, zoom));
return Math.floor((lng + 180) / 360 * Math.pow(2, (zoom>12)?zoom:(zoom+2)));
}
window.latToTile = function(lat, zoom) {
return Math.floor((1 - Math.log(Math.tan(lat * Math.PI / 180) +
1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, zoom));
1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, (zoom>12)?zoom:(zoom+2)));
}
window.tileToLng = function(x, zoom) {
return x / Math.pow(2, zoom) * 360 - 180;
return x / Math.pow(2, (zoom>12)?zoom:(zoom+2)) * 360 - 180;
}
window.tileToLat = function(y, zoom) {
var n = Math.PI - 2 * Math.PI * y / Math.pow(2, zoom);
var n = Math.PI - 2 * Math.PI * y / Math.pow(2, (zoom>12)?zoom:(zoom+2));
return 180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));
}