A package to have maps utils to calculate distance and angle between coordinates, or time for traveling (on distance as the crow flies for now)
Report Bug
·
Request Feature
The goal of this project is to provide utils for your maps calculation as distance, angle, time.
Install NPM packages:
npm install @maxdesplanches/maps-utils
const mapsUtils = require("@maxdesplanches/maps-utils");
const location1 = {
latitude1: 43.6206597,
longitude1: 3.8553517,
};
const location2 = {
latitude2: 43.6211969,
longitude2: 3.8519288,
};
const coordinates = {
...location1,
...location2,
};
const distanceInKm = mapsUtils.getDistanceFromCoordinates(coordinates);
const angleInDegree = mapsUtils.getDegreeAngleFromCoordinates(coordinates);
const transportation = mapsUtils.Transportation.BUS;
const timeInMn1 = mapsUtils.getTimeInMnFromKm(distance, transportation);
const timeInMn2 = mapsUtils.getTimeInMnFromCoordinates(
coordinates,
transportation
);
import {
getTimeInMnFromKm,
getDegreeAngleFromCoordinates,
getDistanceFromCoordinates,
getTimeInMnFromCoordinates,
Transportation,
} from "@maxdesplanches/maps-utils";
const location1 = {
latitude1: 43.6206597,
longitude1: 3.8553517,
};
const location2 = {
latitude2: 43.6211969,
longitude2: 3.8519288,
};
const coordinates = {
...location1,
...location2,
};
const distanceInKm = getDistanceFromCoordinates(coordinates);
const angleInDegree = getDegreeAngleFromCoordinates(coordinates);
const transportation = Transportation.BUS;
const timeInMn1 = getTimeInMnFromKm(distance, transportation);
const timeInMn2 = getTimeInMnFromCoordinates(coordinates, transportation);
http://www.movable-type.co.uk/scripts/latlong.html https://www.calculatorsoup.com/calculators/math/speed-distance-time-calculator.php
Distributed under the MIT License. See LICENSE.txt
for more information.
Max Desplanches - @Max_Desplanches - [email protected]
Project Link: https://github.com/MaxDesplanches/maps-utils