Suggestions API
The purpose of this third endpoint, Suggestions, is to return the geographical coordinates from an address provided in the URL itself.
To make the request to Suggestions you need to send the request using the GET method to the following endpoint:
The URL will send all the parameters for obtaining the geographical coordinates and suggested addresses.
For addresses outside Brazil, you will need to add the query param globalSearch
in the URL, as follows: https://api.maplink.global/geocode/v1/suggestions?globalSearch=true
List of parameters
Mandatory parameter
q
– Inform the address or part of it.
Optional parameters
globalSearch
– Define whether the research will be global or only in Brazil. Possible values: true or falsetype
– Limits the type of research. Only for addresses in Brazil and if the parameterglobalSearch
is not entered. Possible values:ZIPCODE
– Zip code;STATE
– State;CITY
– City;DISTRICT
– Neighborhood.
center
– Reference coordinates for the search for results. Format:center=-23.552088765,-46.6341653162
;radius
– Specifies the search radius, in meters, from the center point set atcenter
. If not entered, the default value is 5,000,000 meters (5,000 Km).
Example 1 – Searching for suggestions from free text
In this example, we want to get suggestions for the text "Alameda Campinas, 01404100, Jardim Paulista"
. The request can be found below:
Note: When using free text to search for suggestions where no type
is provided, it is advisable to describe the address with as much information as possible, ordering the most important elements, and without abbreviations so that the API can better compare the searched text with the results.
In the response, the following information is returned:
found
– Number of records returned.results
– Array of objects with all the results found:id
– Identifier of the address entered in the request;address
– Object with address information:road
– Route name;district
– Neighborhood;zipCode
– Zip code;city
– City;state
– State;mainLocation
– Geographical coordinates atlatitude
/longitude
;
type
– Indicates the best element found in the map base for returning the geographic coordinate;score
– Reference score for the result of the geocoding process;label
– Complete address found used in the geocoding process.
Note: The higher the score
, the greater the relevance of the result to the requested address.
The full response can be found below:
{ "found": 11, "results": [ { "address": { "road": "Alameda Campinas", "district": "Jardim Paulista", "zipCode": "01404100", "city": "São Paulo", "state": { "code": "SP", "name": "São Paulo" }, "mainLocation": { "lat": -23.5665, "lon": -46.65382 } }, "type": "ZIPCODE", "score": 37.228725, "label": "Alameda Campinas, Jardim Paulista, 01404100, São Paulo, São Paulo, SP" }, { "address": { "road": "Alameda Campinas", "district": "Jardim Paulista", "zipCode": "12947480", "city": "Atibaia", "state": { "code": "SP", "name": "São Paulo" }, "mainLocation": { "lat": -23.1410185925, "lon": -46.5576962537 } }, "type": "ZIPCODE", "score": 25.78013, "label": "Alameda Campinas, Jardim Paulista, 12947480, Atibaia, São Paulo, SP" }, { "address": { "road": "Alameda Campinas", "district": "Jardim Paulista", "zipCode": "01404002", "city": "São Paulo", "state": { "code": "SP", "name": "São Paulo" }, "mainLocation": { "lat": -23.57156, "lon": -46.65871 } }, "type": "ZIPCODE", "score": 25.732224, "label": "Alameda Campinas, Jardim Paulista, 01404002, São Paulo, São Paulo, SP" }, { "address": { "road": "Alameda Campinas", "district": "Jardim Paulista", "zipCode": "01404200", "city": "São Paulo", "state": { "code": "SP", "name": "São Paulo" }, "mainLocation": { "lat": -23.5674342, "lon": -46.65478485 } }, "type": "ZIPCODE", "score": 25.732224, "label": "Alameda Campinas, Jardim Paulista, 01404200, São Paulo, São Paulo, SP" }, { "address": { "road": "Alameda Campinas", "district": "Jardim Paulista", "zipCode": "01404000", "city": "São Paulo", "state": { "code": "SP", "name": "São Paulo" }, "mainLocation": { "lat": -23.5665, "lon": -46.65382 } }, "type": "ZIPCODE", "score": 25.13713, "label": "Alameda Campinas, Jardim Paulista, 01404000, São Paulo, São Paulo, SP" }, { "address": { "road": "Alameda Campinas", "district": "Jardim Paulista", "zipCode": "01404001", "city": "São Paulo", "state": { "code": "SP", "name": "São Paulo" }, "mainLocation": { "lat": -23.56767, "lon": -46.65498 } }, "type": "ZIPCODE", "score": 24.93925, "label": "Alameda Campinas, Jardim Paulista, 01404001, São Paulo, São Paulo, SP" }, { "address": { "road": "Alameda Campinas", "district": "Jardim Paulista", "zipCode": "01404003", "city": "São Paulo", "state": { "code": "SP", "name": "São Paulo" }, "mainLocation": { "lat": -23.5727386, "lon": -46.65995255 } }, "type": "ZIPCODE", "score": 24.93925, "label": "Alameda Campinas, Jardim Paulista, 01404003, São Paulo, São Paulo, SP" }, { "address": { "road": "Alameda Campinas 150", "district": "Jardim Paulista", "zipCode": "01404900", "city": "São Paulo", "state": { "code": "SP", "name": "São Paulo" }, "mainLocation": { "lat": -23.5658, "lon": -46.65323 } }, "type": "ZIPCODE", "score": 24.005688, "label": "Alameda Campinas 150, Jardim Paulista, 01404900, São Paulo, São Paulo, SP" }, { "address": { "road": "Alameda Campinas 433", "district": "Jardim Paulista", "zipCode": "01404901", "city": "São Paulo", "state": { "code": "SP", "name": "São Paulo" }, "mainLocation": { "lat": -23.5658, "lon": -46.65323 } }, "type": "ZIPCODE", "score": 24.005688, "label": "Alameda Campinas 433, Jardim Paulista, 01404901, São Paulo, São Paulo, SP" } ] }