Refactoring (in progress) to put most of the logic in Redux reducers.
This commit is contained in:
1 parent
fd79fba51f
commit
db0761efd1
14 files changed
+193
-183
No files matched your search
+4
-8
@@ -1,4 +1,3 @@
|
||||
|
||||
export interface Point {
|
||||
x: number;
|
||||
y: number;
|
||||
@@ -11,21 +10,18 @@ export interface geoPoint {
|
||||
|
||||
// cf https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#ECMAScript_(JavaScript/ActionScript,_etc.)
|
||||
export const lon2tile = (lon: number, zoom: number) => {
|
||||
const real = ((lon + 180) / 360) * Math.pow(2, zoom);
|
||||
const floor = Math.floor(real);
|
||||
return [floor, real - floor];
|
||||
return ((lon + 180) / 360) * Math.pow(2, zoom);
|
||||
};
|
||||
export const lat2tile = (lat: number, zoom: number) => {
|
||||
const real =
|
||||
return (
|
||||
((1 -
|
||||
Math.log(
|
||||
Math.tan((lat * Math.PI) / 180) + 1 / Math.cos((lat * Math.PI) / 180)
|
||||
) /
|
||||
Math.PI) /
|
||||
2) *
|
||||
Math.pow(2, zoom);
|
||||
const floor = Math.floor(real);
|
||||
return [floor, real - floor];
|
||||
Math.pow(2, zoom)
|
||||
);
|
||||
};
|
||||
|
||||
export function tile2long(x: number, z: number) {
|
||||
|
||||
Reference in new issue
Block a user