Reverse Geocode API
The purpose of this second endpoint, Reverse Geocode, is to return information about the address from its coordinates.
- List of parameters
- Example 1 – Search for an address based on a coordinate
- Example 2 – Search for an address based on more than one coordinate
To make the request for Reverse Geocode, you must send the request using the POST method to the following endpoint:
Note: Currently returning only to directions located in Brazil.
The Reverse API has been updated to V2. The endpoint https://api.maplink.global/geocode/v1/reverse will still work, but it is recommended to use the new endpoint for more accurate results and because new features will be exclusive to the new version.
List of parameters
Mandatory parameters
lat
– Latitude;lon
– Longitude.
Optional parameters
id
– Text with the identifier of the address searched;distance
– Maximum distance in meters for the address search. The default value is 2,000 (2 km) and the maximum value is up to 100,000 (100 km)
Note: There is a limit of 200 points for sending in a single request.
Example 1 – Search for an address based on a coordinate
[ { "lat": -23.566617861455924, "lon": -46.65362331449377 } ]
The description of each field present in the response can be found in the following link: Response structure – Geocode API.
The full response can be found below:
{ "results": [ { "id": "6684353bf0662a1541ff635d", "address": { "road": "ALAMEDA CAMPINAS", "district": "JARDIM PAULISTA", "zipCode": "01404000", "city": "SÃO PAULO", "state": { "name": "SÃO PAULO", "code": "SP" }, "mainLocation": { "lat": -23.5663551335, "lon": -46.65364273168 } }, "type": "ROAD", "label": "ALAMEDA CAMPINAS, 01404000, JARDIM PAULISTA, SÃO PAULO, SP", "score": 95.18153327776994, "distance": 29.313601838651707, "precision": "ROAD_CENTROID" } ], "found": 1 }
Example 2 – Search for an address based on more than one coordinate
In this example, we will search for results for two different coordinates. To do this, we need to identify them with the parameter id
. The first point will be "L1"
and the second "L2"
.
The point "L1"
should return results within a radius of 500 meters. For this, we use the parameter distance
.
The full request can be found below:
[ { "id": "L1", "lat": -26.90314282963394, "lon": -48.68018153051618, "distance": 500 }, { "id": "L2", "lat": -26.908620508271895, "lon": -48.67848497677373 } ]
The full response can be found below:
{ "results": [ { "id": "L1", "address": { "road": "RUA LEOPOLDO HESS", "number": "54", "district": "SÃO JOÃO", "zipCode": "88304260", "city": "ITAJAÍ", "state": { "name": "SANTA CATARINA", "code": "SC" }, "mainLocation": { "lat": -26.903134, "lon": -48.680257 }, "numberAsInteger": 54 }, "type": "ROAD", "label": "RUA LEOPOLDO HESS, 88304260, SÃO JOÃO, ITAJAÍ, SC", "score": 98.96608277648525, "distance": 7.556140571987315, "precision": "NUMBER_EXACT" }, { "id": "L2", "address": { "road": "RUA HEITOR LIBERATO", "number": "2057", "district": "SÃO JUDAS", "zipCode": "88303101", "city": "ITAJAÍ", "state": { "name": "SANTA CATARINA", "code": "SC" }, "mainLocation": { "lat": -26.908564, "lon": -48.67848 }, "numberAsInteger": 2057 }, "type": "ROAD", "label": "RUA HEITOR LIBERATO, 88303101, SÃO JUDAS, ITAJAÍ, SC", "score": 99.21863668889449, "distance": 6.309805167165782, "precision": "NUMBER_EXACT" } ], "found": 2 }