Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mapbox Cookbook

You're reading from  Mapbox Cookbook

Product type Book
Published in Mar 2016
Publisher
ISBN-13 9781784397357
Pages 264 pages
Edition 1st Edition
Languages

Table of Contents (13) Chapters

Finding an address from coordinates


The exact opposite of the process we saw just now is to provide the coordinates and get back an address, which is called reverse geocoding.

Let's examine the request structure, which is as follows:

http://api.tiles.mapbox.com/v4/geocode/{index}/{lon},{lat}.json?access_token=<your access token>

At this point, it won't trouble you any more to find what is needed. Apart from index, this time, we need to provide the latitude and longitude.

How to do it…

Perform the following steps:

  1. Construct a GET request by specifying the master source, latitude, and longitude.

  2. Paste the request in the browser or in a REST client.

    You will get back a JSON file with coordinates matching your query.

A complete reverse geocoding query will look similar to this:

http://api.tiles.mapbox.com/v4/geocode/mapbox.places-v1/-6.348457,53.712829.json?access_token=pk.eyJ1Ijoibmltcm9kNyIsImEiOiJkNkw1WWRnIn0.pnQn9P2nbHyhKf2FY_XJog
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}