GeoUtils

Spherical geometry utility class for WME scripts

Αυτός ο κώδικας δεν πρέπει να εγκατασταθεί άμεσα. Είναι μια βιβλιοθήκη για άλλους κώδικες που περιλαμβάνεται μέσω της οδηγίας meta // @require https://update.greasyfork.org/scripts/571719/1785947/GeoUtils.js

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Δημιουργός
Anton Shevchuk
Έκδοση
0.0.1
Δημιουργήθηκε την
29/03/2026
Ενημερώθηκε την
29/03/2026
Μέγεθος
5 KB
Άδεια
MIT

GeoUtils

Spherical geometry utility class for WME (Waze Map Editor) userscripts.

Provides geodesic calculations on a spherical Earth model: bearings, angles, Haversine distances, destination points, and great-circle intersections. All coordinates use [longitude, latitude] order in degrees.

Usage

Load via @require in a userscript header:

// @require  https://greasyfork.org/scripts/.../GeoUtils.user.js

Then use the global GeoUtils class:

const bearing = GeoUtils.getBearing([30.52, 50.45], [-0.13, 51.51]);
const distance = GeoUtils.getDistance([30.52, 50.45], [-0.13, 51.51]);

API

Method Description
getBearing(pA, pB) Initial bearing from pA to pB (0-360)
findAngle(p1, p2, p3) Interior angle at vertex p2 (0-180)
getDistance(pA, pB) Distance in meters (Haversine)
getAngularDistance(pA, pB) Distance in radians
getDestination(point, bearing, distRad) Point at given bearing and angular distance
findIntersection(pA, pB, pC, angle) Point on line AB making given angle with C
findRightAngleIntersection(pA, pB, pC) Perpendicular foot from C onto line AB

Development

npm install
npm run build
npm test

Links

Author homepage: https://anton.shevchuk.name/
Author pet projects: https://hohli.com/
Support author: https://donate.hohli.com/