Chore: improve types, add checks

This commit is contained in:
Pieter Vander Vennet 2025-04-03 02:12:59 +02:00
parent 6e4879fb0d
commit 4b3e1fad4f
3 changed files with 17 additions and 10 deletions

View file

@ -10,15 +10,16 @@ import {
MultiPolygon,
Point,
Polygon,
Position,
Position
} from "geojson"
import { Tiles } from "../Models/TileRange"
import { Utils } from "../Utils"
;("use strict")
("use strict")
export class GeoOperations {
private static readonly _earthRadius = 6378137
private static readonly _originShift = (2 * Math.PI * GeoOperations._earthRadius) / 2
private static readonly _earthRadius: number = 6378137
private static readonly _originShift: number = (2 * Math.PI * GeoOperations._earthRadius) / 2
private static readonly directions = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"] as const
private static readonly directionsRelative = [
"straight",
@ -480,7 +481,7 @@ export class GeoOperations {
const lon = lonLat[0]
const lat = lonLat[1]
const x = (180 * lon) / GeoOperations._originShift
let y = (180 * lat) / GeoOperations._originShiftcons
let y = (180 * lat) / GeoOperations._originShift
y = (180 / Math.PI) * (2 * Math.atan(Math.exp((y * Math.PI) / 180)) - Math.PI / 2)
return [x, y]
}