This commit is contained in:
choelzl 2022-02-09 03:21:37 +01:00
parent 108fdac4e0
commit 5947ea7eb8
Signed by: sora
GPG Key ID: A362EA0491E2EEA0

View File

@ -27,11 +27,6 @@
return data.countryCode; return data.countryCode;
} }
}; };
function getSurroundings (location) {
const meters = 100;
const R_EARTH = 6378.137;
const M = 1 / (((2 * Math.PI) / 360) * R_EARTH) / 1000;
function moveFrom(coords, angle, distance) { function moveFrom(coords, angle, distance) {
let radianAngle = (angle * Math.PI) / 180; let radianAngle = (angle * Math.PI) / 180;
let x = 0 + distance * Math.cos(radianAngle); let x = 0 + distance * Math.cos(radianAngle);
@ -40,6 +35,10 @@
let newLng = coords.lng + (x * M) / Math.cos(coords.lat * (Math.PI / 180)); let newLng = coords.lng + (x * M) / Math.cos(coords.lat * (Math.PI / 180));
return { lat: newLat, lng: newLng }; return { lat: newLat, lng: newLng };
} }
function getSurroundings (location) {
const meters = 100;
const R_EARTH = 6378.137;
const M = 1 / (((2 * Math.PI) / 360) * R_EARTH) / 1000;
let coordinates = [location]; let coordinates = [location];
for (let angle = 0; angle < 360; angle += 45) { for (let angle = 0; angle < 360; angle += 45) {
coordinates.push(moveFrom({ lat: location.lat, lng: location.lng }, angle, meters)); coordinates.push(moveFrom({ lat: location.lat, lng: location.lng }, angle, meters));