google-map-js
-> npm i google-map-js
google-map-js
Example:
This example is get 2 points routes and distance calculate
const latitudeA = 00.000000; // Latitude of point A
const longitudeA = 00.000000; // Longitude of point A
const latitudeB = 00.000000; // Latitude of point B
const longitudeB = 00.000000; // Longitude of point B
const mapDistanceCalculater = require('google-map-js')
const data = await mapDistanceCalculater.DirectionsService(latitudeA, longitudeA, latitudeB, longitudeB, 'Google map api key');
data returns
{
{ routeDetails: Returns full details of distance route details,
mapDistanceUrl: Distance map URL,
distance: Distance with miles in 2 digits
}
}
Address using to get the latitude longitude
const mapDistanceCalculater = require('google-map-js')
const data = await mapDistanceCalculater.GetAddressToLatitudeLongitude('Your address', 'Google map api key');
data returns
{
{
latitude: Repective address latitude,
longitude: Repective address longitude
}
}