geocode-to-pincode

Tiny library for obtaining pincode from geo coordinates

Usage no npm install needed!

<script type="module">
  import geocodeToPincode from 'https://cdn.skypack.dev/geocode-to-pincode';
</script>

README

geocode-to-pincode

A small package to extract out pincode for any location using geocodes (latitudes and longitudes)

Installation

npm i geocode-to-pincode

Usage

const geocodeToPincode = require("geocode-to-pincode");

geocodeToPincode({lat: 28.591, lng: 77.319, key: 'you-google-maps-api-key'})
  .then(response => console.log(response.pincode)) // prints '201301'
  .catch(error => console.log(error)) // prints error object as is

// supply key either in options or as an environment variable as shown below
// GOOGLE_MAPS_API_KEY=your-actual-google-apis-key

// if for some reason pincode doesn't exist for that location
// then it prints 'NotFound' without error, this case will mostly
// not be there if the location is valid, meaning, location has a
// pincode associated with it

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.