nativescript-mapbox
Version:
A Nativescript plugin for Mapbox Native Maps.
20 lines (19 loc) • 639 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var GeoUtils = (function () {
function GeoUtils() {
}
GeoUtils.isLocationInCircle = function (lng, lat, circleLng, circleLat, circleRadius) {
var ky = 40000 / 360;
var kx = Math.cos(Math.PI * circleLat / 180.0) * ky;
var dx = Math.abs(circleLng - lng) * kx;
var dy = Math.abs(circleLat - lat) * ky;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < circleRadius / 1000) {
return true;
}
return false;
};
return GeoUtils;
}());
exports.GeoUtils = GeoUtils;
;