Geocoder API Developer's Guide

Location for an Address in an Area

The user wants to retrieve the latitude, longitude and complete address details of '1 Main St' within a specific viewport.

Request

The following GET request uses the parameter searchtext to specify the encoded value of the free-form address and the parameter mapview to define the area in which to search.

https://geocoder.ls.hereapi.com/6.2/geocode.json
?apiKey={YOUR_API_KEY}
&searchtext=1%20main
&mapview=42.3902%2C-71.1293%3B42.3312%2C-71.0228
Note: This example uses a HERE API Key to authenticate your request. For the available authentication options, see the Identity & Access Management Developer Guide.

Response

The response to the request contains the following information blocks:
  • metadata about the request
  • information about each address that matches the address information in the mapview, including
    • match quality
    • location information
    • address information
{"Response": {
  "MetaInfo": {
    "Timestamp": "2016-11-09T11:27:32.535+0000",
    "NextPageInformation": "2"
  },
  "View": [{
    "_type": "SearchResultsViewType",
    "ViewId": 0,
    "Result": [
      {
        "Relevance": 1,
        "Distance": 389.4,
        "MatchLevel": "houseNumber",
        "MatchQuality": {
          "Street": [0.85],
          "HouseNumber": 1
        },
        "MatchType": "pointAddress",
        "Location": {
          "LocationId": "NT_4q1.GYkK3gozFkHjEoFG-A_xA",
          "LocationType": "point",
          "DisplayPosition": {
            "Latitude": 42.36225,
            "Longitude": -71.0803
          },
          "NavigationPosition": [{
            "Latitude": 42.36195,
            "Longitude": -71.0801
          }],
          "MapView": {
            "TopLeft": {
              "Latitude": 42.3633742,
              "Longitude": -71.0818214
            },
            "BottomRight": {
              "Latitude": 42.3611258,
              "Longitude": -71.0787786
            }
          },
          "Address": {
            "Label": "1 Main St, Cambridge, MA 02142, United States",
            "Country": "USA",
            "State": "MA",
            "County": "Middlesex",
            "City": "Cambridge",
            "District": "East Cambridge",
            "Street": "Main St",
            "HouseNumber": "1",
            "PostalCode": "02142",
            "AdditionalData": [
              {
                "value": "United States",
                "key": "CountryName"
              },
              {
                "value": "Massachusetts",
                "key": "StateName"
              },
              {
                "value": "Middlesex",
                "key": "CountyName"
              },
              {
                "value": "N",
                "key": "PostalCodeType"
              }
            ]
          }
        }
      },
     
     ...
     
     // Additional objects removed for readability

    ]
  }]
}}