Geocode

Reverse Geocode API

The purpose of this second endpoint, Reverse Geocode, is to return information about the address from its coordinates.

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.

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
    }
]

In the response, the following information is returned:

  • found – Number of records returned.
  • results – Array of objects with all the results found:
    • id – Address identifier provided in the request;
    • address – Object with address information:
      • road – Name of the road;
      • district – District;
      • zipCode – Zipcode;
      • city – City;
      • state – State;
      • mainLocation – Object with the geographic coordinates of the point:
        • lat – Latitude;
        • lon – Longitude;
      • numberAsInteger – Address number, but returned as an integer instead of a string;
    • type – Indicates the best element found in the cartographic database for returning the geographic coordinate;
    • score – Reference score of 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 for the requested address.

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
        }
    ],
    "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 CONCEIÇÃO",
                "number": "656",
                "district": "SÃO JOÃO",
                "zipCode": "88304220",
                "city": "ITAJAÍ",
                "state": {
                    "name": "SANTA CATARINA",
                    "code": "SC"
                },
                "mainLocation": {
                    "lat": -26.903700093479443,
                    "lon": -48.680039930963865
                },
                "numberAsInteger": 656
            },
            "type": "ROAD",
            "label": "RUA CONCEIÇÃO, 88304220, SÃO JOÃO, ITAJAÍ, SC",
            "score": 91.04826378482639,
            "distance": 63.60663670637282
        },
        {
            "id": "L2",
            "address": {
                "road": "AVENIDA GOVERNADOR ADOLFO KONDER",
                "number": "229",
                "district": "CIDADE NOVA",
                "zipCode": "88308001",
                "city": "ITAJAÍ",
                "state": {
                    "name": "SANTA CATARINA",
                    "code": "SC"
                },
                "mainLocation": {
                    "lat": -26.908558931768667,
                    "lon": -48.67824030691178
                },
                "numberAsInteger": 229
            },
            "type": "ROAD",
            "label": "AVENIDA GOVERNADOR ADOLFO KONDER, 88308001, CIDADE NOVA, ITAJAÍ, SC",
            "score": 95.79443936391044,
            "distance": 25.236232052027663
        }
    ],
    "found": 2
}