@devkosta/reverse-geocode
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

Reverse Geocode

A Module to Transform Coordinates into Human-Readable Location Data. This module utilises the Google Maps Geocoding API.

Installation

npm install @devkosta/reverse-geocode --save-dev
yarn add @devkosta/reverse-geocode

How to Use

import { reverseGeocode } from '@devkosta/reverse-geocode';

/**
  * @param {string} apiKey
  * @param {number} lat
  * @param {number} lng
  *
  * @returns {Promise}
  */

reverseGeocode('YOUR GOOGLE API KEY', 38.8977, 77.0365)
	.then((res) => {
		const formattedAddress = res.results[0].formatted_address;
		console.log(formattedAddress);
	})
	.catch((error) => {
		console.error(error);
	});

Props

Property Type Required? Description
apiKey String Your Google API KEY. This can be retrieved from here.
lat Number The latitude value to be parsed.
lng Number The longitude value to be parsed.

License

MIT © DevKosta

Package Sidebar

Install

npm i @devkosta/reverse-geocode

Weekly Downloads

2

Version

1.0.5

License

ISC

Unpacked Size

6.12 kB

Total Files

4

Last publish

Collaborators

  • devkosta