@maxdesplanches/maps-utils
v1.1.6
Published
Calculate distance, angle or time from 2D coordinates ! (latitude, longitude
Downloads
4
Readme
About The Project
The goal of this project is to provide utils for your maps calculation as distance, angle, time.
Getting Started
Installation
Install NPM packages:
npm install @maxdesplanches/maps-utils
Usage (NodeJS, TypeScript below)
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
);
Usage (Typescript)
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);
Ressources
http://www.movable-type.co.uk/scripts/latlong.html https://www.calculatorsoup.com/calculators/math/speed-distance-time-calculator.php
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Contact
Max Desplanches - @Max_Desplanches - [email protected]
Project Link: https://github.com/MaxDesplanches/maps-utils