1.0.2 • Published 6 years ago
fgeocoder v1.0.2
fgeocoder
A utility for using the Google Geocoding API
Prerequisites
- Node JS
- NPM
- Google Geocoding API Key
Installing
Download from npm
npm install fgeocoder --save
Download from GitHub
git clone https://github.com/Fixy250185/fgeocoder.git
Usage
const geocode = require('fgeocoder')
geocode.SetConfig({apiKey: 'YOUR API KEY HERE'})
geocode.Get('42 Wallaby Way, Sydney')
.then(response => console.log(response))
.catch(error => console.log('There was an error:', error))
Will result in
{ results:
[
{
address_components: [Array],
formatted_address: '42 Rock Wallaby Way, Blaxland NSW 2774, Australia',
geometry: [Object],
partial_match: true,
place_id: 'EjE0MiBSb2NrIFdhbGxhYnkgV2F5LCBCbGF4bGFuZCBOU1cgMjc3NCwgQXVzdHJhbGlh',
types: [Array]
}
],
status: 'OK' }
Reverse Geolocation
geocode.Reverse(-33.857281, 150.877813)
.then(response => console.log(response))
.catch(error => console.log('There was an error:', error))
Will result in
{ results:
[
{
address_components: [Array],
formatted_address: '9 Wallaby Cl, Bossley Park NSW 2176, Australia',
geometry: [Object],
place_id: 'Ei45IFdhbGxhYnkgQ2wsIEJvc3NsZXkgUGFyayBOU1cgMjE3NiwgQXVzdHJhbGlh',
types: [Array]
},
...