nodejs-geocoding 1.1.0
Install from the command line:
Learn more about npm packages
$ npm install @aashari/nodejs-geocoding@1.1.0
Install via package.json:
"@aashari/nodejs-geocoding": "1.1.0"
About this version
NodeJS library that encode and decode geolocation which helps you convert latitude and longitude to formatted address, or formatted_address to latitude and longitude.
via yarn:
yarn add @aashari/nodejs-geocoding
via npm:
npm i @aashari/nodejs-geocoding
// importing the dependency
const geocoding = require('@aashari/nodejs-geocoding');
// decode latitude and longitude to formatted address
geocoding.decode(-6.170131, 106.8241607).then(result => {
console.log(result);
});
{
latitude: -6.170131,
longitude: 106.8241607,
formatted_address: 'Jl. Medan Merdeka Utara No.3, RT.2/RW.3, Gambir, Kecamatan Gambir, Kota Jakarta Pusat, Daerah Khusus Ibukota Jakarta 10110',
google_plus_code: 'RRHF+WMV Gambir, Kota Jakarta Pusat, Daerah Khusus Ibukota Jakarta'
}
// importing the dependency
const geocoding = require('@aashari/nodejs-geocoding');
// encode formatted address to latitude and longitude
geocoding.encode("jalan merdeka utara no.3 jakarta").then(result => {
console.log(result);
});
[
{
formatted_address: 'Jalan Medan Merdeka Utara No.3, RT.3/RW.2, Gambir, Central Jakarta City, Jakarta',
latitude: -6.1715111,
longitude: 106.8269598
},
{
formatted_address: 'Jalan Medan Merdeka Utara, RT.3/RW.2, Gambir, Central Jakarta City, Jakarta',
latitude: -6.1715111,
longitude: 106.8269598
}
]