1.1.1 • Published 2 years ago

@tarisa/googlemap v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Google Map API

npm

test

Install

$ npm install @tarisa/googlemap

Usage

const googleMapApi = require("@tarisa/googlemap");

getNearestOutlet(coordinate_destination)

Return nearest outlet's name and distance (in meters)

const res = await googleMapApi.getNearestOutlet("-6.185190070886394,106.78024483342767", YOUR_API_KEY, YOUR_OUTLET_TABLE_NAME);
console.log(res);
//=> { name: 'Tanjung Duren', distance: 1652 }

getLatitudeLongitude(gmap_url)

Return latitude and longitude

const res = await googleMapApi.getLatitudeLongitude("https://goo.gl/maps/AB1GKJEcMRvHXPbe9", YOUR_API_KEY, YOUR_OUTLET_TABLE_NAME);
console.log(res);
//=> { latitude: -6.203805555555555, longitude: 106.78252777777777 }

const res = await googleMapApi.getLatitudeLongitude("https://maps.google.com/?q=-6.186981752709504,106.7933139950037", YOUR_API_KEY);
console.log(res);
//=> { latitude: '-6.186981752709504', longitude: '106.7933139950037' }