Search for an address near a geo-position

This tutorial demonstrates how to search for an address using its geo-position.

Procedure

End users can search for a textual latitude/longitude geo-position and retrieve the nearest address and its distance from the search center (the value of the at parameter). The following units and formats are supported on /discover and /autosuggest endpoints.

  • latitude and longitude in sexagesimal degrees

    for example: 59 53 30 N 30 21 11 E

  • latitude and longitude in degrees and decimal minutes

    for example: 59.89171,30.35314

The result is by default in the language of the queried position.

To search for the closest address to the geo-position 59 53 30 N 30 21 11 E, an application centered in Mexico would send the request:

GET https://discover.search.hereapi.com/v1/
    discover
    ?at=39.28808,-76.54617
    &lang=es-ES
    &q=59+53+30+N+30+21+11+E
    &apiKey={YOUR_API_KEY}

The following parameters are used:

  • at - Specify the center of the search context expressed as coordinates.
  • lang - Select the language to be used for result rendering from a list of BCP 47 compliant language codes.
  • q - Enter a free-text query.
  • apiKey - Your API key.

Note

This request uses API key authentication. For more information about authentication options on the HERE platform, see the Identity & Access Management Guide.

The related result appears as follows:

{
  "items": [
    {
      "title": "Volkovskiy prospekt 61, San Petersburgo, Rusia, 192102",
      "id": "here:af:streetsection:KjyjeR89GuuvRuAyOf2BtD:CgcIBCCxhuE0EAEaAjYx",
      "resultType": "houseNumber",
      "houseNumberType": "PA",
      "address": {
        "label": "Volkovskiy prospekt 61, San Petersburgo, Rusia, 192102",
        "countryCode": "RUS",
        "countryName": "Rusia",
        "state": "Distrito Federal del Noroeste",
        "county": "San Petersburgo",
        "city": "San Petersburgo",
        "district": "Frunzenskiy rayon",
        "street": "Volkovskiy prospekt",
        "postalCode": "192102",
        "houseNumber": "61"
      },
      "position": { "lat": 59.89076, "lng": 30.35442 },
      "access": [{ "lat": 59.89081, "lng": 30.35489 }],
      "distance": 7141017,
      "mapView": { "west": 30.3549, "south": 59.87979, "east": 30.36541, "north": 59.90181 }
    }
  ]
}

Additional information

For more information about /discover parameters, see: API Reference.

results matching ""

    No results matching ""