Reverse Geocoding: Reverse geocoding converts geographic coordinates into geographic features or features that exist at that location. For example, turning 22.7196, 75.8577 into ‘Indore’. Mapbox is popular for Geocoding API and other locations and map services.
Feature of Mapbox Reverse Geocoding API:
- It is easy to get started and easy to use.
- It converts geographic coordinates into location.
Installation of request module:
- You can visit the link to Install Request module. You can install this package by using this command.
npm install request
- After installing request module you can check your request version in command prompt using the command.
npm version request
- Now go to Mapbox Offical website and create an account and get your API KEY.
- After that, you can create a folder and add a file, for example index.js. To run this file you need to run the following command.
node index.js
Filename: index.js
const request = require('request'); var ACCESS_TOKEN = 'Your_API_KEY'; const reverseGeocoding = function (latitude, longitude) { + longitude + ', ' + latitude + '.json?access_token=' + ACCESS_TOKEN; request({ url: url, json: true }, function (error, response) { if (error) { console.log('Unable to connect to Geocode API'); } else if (response.body.features.length == 0) { console.log('Unable to find location. Try to' + ' search another location.'); } else { console.log(response.body.features[0].place_name); } }) } // Sample data (Indore lat-long) var latitude = 22.7196; var longitude = 75.8577; // Function call reverseGeocoding(latitude, longitude); |
Steps to run the program:
- The project structure will look like this:

- Make sure you have installed request module using following command:
npm install request
- Run index.js file using below command:
node index.js

So this is how you can use the Mapbox Reverse Geocoding API which converts geographic coordinates into geographic features or features that exist at that location.
Recommended Posts:
- Node.js | Mapbox Forward Geocoding API
- Nodejs | Automatic restart NodeJs server with nodemon
- NodeJS | Building simple REST API in express
- Difference between REST API and SOAP API
- Nodejs - Connect MongoDB with Node app using MongooseJS
- Cowsay in Nodejs using Requests library
- Nodejs | Web Crawling using Cheerio
- Web-Socket in NodeJS
- Signup Form Using Nodejs and MongoDB
- Dockerizing a simple Nodejs app
- Nodejs | DNS
- Encrypting Data in NodeJS
- Difference between NodeJS and AngularJS
- Nodejs | Jimp
- Nodejs – Connect Mysql with Node app
- Nodejs | DNS | setServers()
- NodeJs - Handling invalid routes
- Nodejs | authentication using Passportjs and passport-local-mongoose
- Nodejs | GM charcoal() Function
- Nodejs | GM blur() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

