How to Reverse Geocode an Address in Node.JS

When providing direct delivery or location-specific services to customers, knowing exactly where they are located and how to reach that point on accessible roadways is imperative. This is where reverse geocoding for street addresses can become a major asset to your organization. For example, if your business relies on mobile location or mapping technology, reverse geocoding will allow you to translate a point’s latitude and longitude to a standardized address, which can then be read and reached on a map. The following API will allow you to automatically reverse geocode any latitude and longitude set to return a street address instantly.

Image for post
Image for post

Our first step will be to install the SDK:

npm install cloudmersive-validate-api-client --save

You may also add this snippet to your package.json:

"dependencies": {
"cloudmersive-validate-api-client": "^1.2.4"
}

Now, we can call our function:

var CloudmersiveValidateApiClient = require('cloudmersive-validate-api-client');
var defaultClient = CloudmersiveValidateApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveValidateApiClient.AddressApi();var input = new CloudmersiveValidateApiClient.ReverseGeocodeAddressRequest(); // ReverseGeocodeAddressRequest | Input reverse geocoding requestvar callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.addressReverseGeocodeAddress(input, callback);

Following this tutorial will help automate your business and improve your efficiency immediately, with little hassle or stress. You can retrieve your free API Key from Cloudmersive. This will give you access to 800 monthly calls across our API library.

Written by

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store