added parseFloat to maps module so it properly parses lat and long from strings

pull/89/head
Bernat Romagosa 2019-06-06 10:39:01 +02:00
rodzic e58328ebc7
commit 1da0ddef1f
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -200,12 +200,12 @@ WorldMap.prototype.wrapTile = function (n) {
}; };
WorldMap.prototype.tileXfromLon = function (lon) { WorldMap.prototype.tileXfromLon = function (lon) {
return (lon + 180) / 360 * Math.pow(2, this.zoom); return (parseFloat(lon) + 180) / 360 * Math.pow(2, this.zoom);
}; };
WorldMap.prototype.tileYfromLat = function (lat) { WorldMap.prototype.tileYfromLat = function (lat) {
return (1 - Math.log(Math.tan(lat * Math.PI / 180) + 1 / return (1 - Math.log(Math.tan(parseFloat(lat) * Math.PI / 180) + 1 /
Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.cos(parseFloat(lat) * Math.PI / 180)) / Math.PI) / 2 *
Math.pow(2, this.zoom); Math.pow(2, this.zoom);
}; };