Displaying a GPX track
This commit is contained in:
1 parent
a559a37952
commit
3856e4b516
4 files changed
+42
-2
No files matched your search
+3
-2
@@ -10,13 +10,14 @@ export interface geoPoint {
|
||||
|
||||
// cf https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#ECMAScript_(JavaScript/ActionScript,_etc.)
|
||||
export const lon2tile = (lon: number, zoom: number) => {
|
||||
return ((lon + 180) / 360) * Math.pow(2, zoom);
|
||||
return ((Number(lon) + 180) / 360) * Math.pow(2, zoom);
|
||||
};
|
||||
export const lat2tile = (lat: number, zoom: number) => {
|
||||
return (
|
||||
((1 -
|
||||
Math.log(
|
||||
Math.tan((lat * Math.PI) / 180) + 1 / Math.cos((lat * Math.PI) / 180)
|
||||
Math.tan((Number(lat) * Math.PI) / 180) +
|
||||
1 / Math.cos((Number(lat) * Math.PI) / 180)
|
||||
) /
|
||||
Math.PI) /
|
||||
2) *
|
||||
|
||||
Reference in new issue
Block a user