Multi Geocode API
The purpose of this last endpoint is to return geographical coordinates from multiple addresses, either complete or partial.
- List of parameters
- Example 1 – Searching for coordinates of two or more addresses in the same request
- Response
To make the request to Multi Geocode you need to send the request using the POST method to the following endpoint:
List of parameters
Mandatory parameters
id
– Text with the identifier of the searched address.
It is compulsory to enter at least one of the parameters below. It is not necessary to inform everyone. However, the more information you provide, the more accurate the result will be.
road
– Name of the street or part of it;number
– Street number. DO NOT enter the complement data.city
– Name of city;state
– State;country
– Country;district
– Name of the neighborhood;zipcode
– Zip code;label
– Complete address. It is recommended to type the text in the order “Street name, number, zip code, district, city, state”.
Note: Currently returning only to directions located in Brazil.
Note: There is a limit of 200 points for submission in a single request.
Optional parameters
mainLocation
– Object with two parameters to limit the address search area:center
– Object with the reference coordinates for the search results. The coordinates can be entered in the following formats:- Object with the
lat
andlon
properties that represent latitude and longitude respectively. Example:{"lat":-23.0852, "lon": -46.98020}
- Array with latitude and longitude. Example:
[-23.0852, -46.98020]
- Coordinates encoded as geohash. Example:
"6tr6df675"
- Object with the
radius
– Search radius, in meters, from the central point defined in center. If not entered, the default value is 500,000 meters (500 km).
Example 1 – Searching for coordinates of two or more addresses in the same request
In this example, we’re going to look for two different addresses in the same request. To do this, we need to identify each address with the parameter id
.
The first will be "Address1"
and the second "Address2"
. The full request can be seen below:
[ { "id": "Address1", "road": "Leopoldo Hess", "number": 75, "district": "São João", "zipcode": "88304-260", "city": "Itajai", "state": "SC" }, { "id": "Address2", "road": "Alameda Campinas", "number": 579, "zipcode": "01419-001", "city": "São Paulo", "state": "SP" } ]
Response
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": "Address1", "address": { "road": "RUA LEOPOLDO HESS", "number": "75", "district": "SÃO JOÃO", "zipCode": "88304260", "city": "ITAJAÍ", "state": { "name": "SANTA CATARINA", "code": "SC" }, "mainLocation": { "lat": -26.903004, "lon": -48.680296 }, "numberAsInteger": 75 }, "type": "ROAD", "label": "RUA LEOPOLDO HESS, 88304260, SÃO JOÃO, ITAJAÍ, SC", "score": 96.79654045442564, "precision": "NUMBER_EXACT" }, { "id": "Address2", "address": { "road": "ALAMEDA CAMPINAS", "district": "JARDIM PAULISTA", "zipCode": "01404001", "city": "SÃO PAULO", "state": { "name": "SÃO PAULO", "code": "SP" }, "mainLocation": { "lat": -23.56880844109, "lon": -46.65604091167 } }, "type": "ROAD", "label": "ALAMEDA CAMPINAS, 01404001, JARDIM PAULISTA, SÃO PAULO, SP", "score": 96.91391938959099, "precision": "ROAD_CENTROID" } ], "found": 2 }