Limit results to specific types

This tutorial demonstrates how to limit the results to specific types by /revgeocode endpoint.

Procedure

The /revgeocode endpoint has an optional parameter types that allows limiting the results to specific types.

The following result type filter values, supported by the /revgeocode endpoint, are available:

  • address - Retrieve the closest street address for the position provided in the request. The search algorithm may return an exact street address, or if no nearby address is found, a street result or a country-specific address. In the case of Japan, this may be an address block, while in the UK and some other countries, a high precision postal code may be returned.
  • street - Retrieve the closest street for the position provided in the request.
  • area - Retrieve the area information for the position provided in the request. The area can be a locality or an administrative area.
  • city - Retrieve the city for the position provided in the request.

Let's take the query at=50.1158056,8.6786751 as an example:

GET https://revgeocode.search.hereapi.com/v1/
    revgeocode
    ?at=50.1158056,8.6786751
    &limit=3
    &lang=en-US
    &apiKey={YOUR_API_KEY}

The following parameters are used:

  • at - Specify the center of the search context expressed as coordinates.
  • limit - Maximum number of results to be returned.
  • lang - Select the language to be used for result rendering from a list of BCP 47 compliant language codes.
  • 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.

Without any result type restriction, the /revgeocode endpoint returns results of different types, including address and place:

{
    "items": [
        {
            "title": "Schillerstraße 15, 60313 Frankfurt am Main, Deutschland",
            "id": "here:af:streetsection:9Lt20lMTkEV8MQcgHBlhWB:CgcIBCDiz4lQEAEaAjE1",
            "resultType": "houseNumber",
            "houseNumberType": "PA",
            "address": {
                "label": "Schillerstraße 15, 60313 Frankfurt am Main, Deutschland",
                "countryCode": "DEU",
                "countryName": "Deutschland",
                "stateCode": "HE",
                "state": "Hessen",
                "countyCode": "F",
                "county": "Frankfurt am Main",
                "city": "Frankfurt am Main",
                "district": "Innenstadt",
                "street": "Schillerstraße",
                "postalCode": "60313",
                "houseNumber": "15"
            },
            "position": {
                "lat": 50.11581,
                "lng": 8.67859
            },
            "access": [
                {
                    "lat": 50.11579,
                    "lng": 8.67873
                }
            ],
            "distance": 4,
            "mapView": {
                "west": 8.67868,
                "south": 50.11558,
                "east": 8.67917,
                "north": 50.11681
            }
        },
        {
            "title": "Rahmhofstraße 2, 60313 Frankfurt am Main, Deutschland",
            "id": "here:af:streetsection:u.HHRJ-pBkKi8DP.A7MeeD:CgcIBCCF-7tQEAEaATI",
            "resultType": "houseNumber",
            "houseNumberType": "PA",
            "address": {
                "label": "Rahmhofstraße 2, 60313 Frankfurt am Main, Deutschland",
                "countryCode": "DEU",
                "countryName": "Deutschland",
                "stateCode": "HE",
                "state": "Hessen",
                "countyCode": "F",
                "county": "Frankfurt am Main",
                "city": "Frankfurt am Main",
                "district": "Innenstadt",
                "street": "Rahmhofstraße",
                "postalCode": "60313",
                "houseNumber": "2"
            },
            "position": {
                "lat": 50.11566,
                "lng": 8.67839
            },
            "access": [
                {
                    "lat": 50.11559,
                    "lng": 8.67837
                }
            ],
            "distance": 27,
            "mapView": {
                "west": 8.67691,
                "south": 50.11558,
                "east": 8.67868,
                "north": 50.11571
            }
        },
        {
            "title": "Schwarz Kaffeemobil",
            "id": "here:pds:place:276u0yjj-ec90c8f5d8d79f27a07fb357ba5470c2",
            "resultType": "place",
            "address": {
                "label": "Schwarz Kaffeemobil, Schillerstraße 21, 60313 Frankfurt am Main, Deutschland",
                "countryCode": "DEU",
                "countryName": "Deutschland",
                "stateCode": "HE",
                "state": "Hessen",
                "countyCode": "F",
                "county": "Frankfurt am Main",
                "city": "Frankfurt am Main",
                "district": "Innenstadt",
                "street": "Schillerstraße",
                "postalCode": "60313",
                "houseNumber": "21"
            },
            "position": {
                "lat": 50.11613,
                "lng": 8.67825
            },
            "access": [
                {
                    "lat": 50.11607,
                    "lng": 8.6788
                }
            ],
            "distance": 30,
            "categories": [
                {
                    "id": "100-1100-0010",
                    "name": "Kaffeehaus",
                    "primary": true
                }
            ]
        }
    ]
}

If the end user is not interested in place results, the customer application can restrict results to type address:

GET https://revgeocode.search.hereapi.com/v1/
    revgeocode
    ?at=50.1158056,8.6786751
    &types=address
    &limit=3
    &apiKey={YOUR_API_KEY}

The place result is not returned, all results are addresses:

{
    "items": [
        {
            "title": "Schillerstraße 15, 60313 Frankfurt am Main, Deutschland",
            "id": "here:af:streetsection:9Lt20lMTkEV8MQcgHBlhWB:CgcIBCDiz4lQEAEaAjE1",
            "resultType": "houseNumber",
            "houseNumberType": "PA",
            "address": {
                "label": "Schillerstraße 15, 60313 Frankfurt am Main, Deutschland",
                "countryCode": "DEU",
                "countryName": "Deutschland",
                "stateCode": "HE",
                "state": "Hessen",
                "countyCode": "F",
                "county": "Frankfurt am Main",
                "city": "Frankfurt am Main",
                "district": "Innenstadt",
                "street": "Schillerstraße",
                "postalCode": "60313",
                "houseNumber": "15"
            },
            "position": {
                "lat": 50.11581,
                "lng": 8.67859
            },
            "access": [
                {
                    "lat": 50.11579,
                    "lng": 8.67873
                }
            ],
            "distance": 4,
            "mapView": {
                "west": 8.67868,
                "south": 50.11558,
                "east": 8.67917,
                "north": 50.11681
            }
        },
        {
            "title": "Rahmhofstraße 2, 60313 Frankfurt am Main, Deutschland",
            "id": "here:af:streetsection:u.HHRJ-pBkKi8DP.A7MeeD:CgcIBCCF-7tQEAEaATI",
            "resultType": "houseNumber",
            "houseNumberType": "PA",
            "address": {
                "label": "Rahmhofstraße 2, 60313 Frankfurt am Main, Deutschland",
                "countryCode": "DEU",
                "countryName": "Deutschland",
                "stateCode": "HE",
                "state": "Hessen",
                "countyCode": "F",
                "county": "Frankfurt am Main",
                "city": "Frankfurt am Main",
                "district": "Innenstadt",
                "street": "Rahmhofstraße",
                "postalCode": "60313",
                "houseNumber": "2"
            },
            "position": {
                "lat": 50.11566,
                "lng": 8.67839
            },
            "access": [
                {
                    "lat": 50.11559,
                    "lng": 8.67837
                }
            ],
            "distance": 27,
            "mapView": {
                "west": 8.67691,
                "south": 50.11558,
                "east": 8.67868,
                "north": 50.11571
            }
        },
        {
            "title": "Große Eschenheimer Straße 13, 60313 Frankfurt am Main, Deutschland",
            "id": "here:af:streetsection:VO7eTHzu807EUG7vuttz3D:EAIaAjEz",
            "resultType": "houseNumber",
            "houseNumberType": "interpolated",
            "address": {
                "label": "Große Eschenheimer Straße 13, 60313 Frankfurt am Main, Deutschland",
                "countryCode": "DEU",
                "countryName": "Deutschland",
                "stateCode": "HE",
                "state": "Hessen",
                "countyCode": "F",
                "county": "Frankfurt am Main",
                "city": "Frankfurt am Main",
                "district": "Innenstadt",
                "street": "Große Eschenheimer Straße",
                "postalCode": "60313",
                "houseNumber": "13"
            },
            "position": {
                "lat": 50.11562,
                "lng": 8.67934
            },
            "access": [
                {
                    "lat": 50.1156,
                    "lng": 8.67955
                }
            ],
            "distance": 52,
            "mapView": {
                "west": 8.67935,
                "south": 50.11406,
                "east": 8.67985,
                "north": 50.1171
            }
        }
    ]
}

If the end user is tracking which street the driver is on, the customer application can restrict results to type street:

GET https://revgeocode.search.hereapi.com/v1/
    revgeocode
    ?at=50.1158056,8.6786751
    &types=street
    &apiKey={YOUR_API_KEY}

The result is the closest street:

{
    "items": [
        {
            "title": "Schillerstraße, 60313 Frankfurt am Main, Deutschland",
            "id": "here:af:streetsection:9Lt20lMTkEV8MQcgHBlhWB",
            "resultType": "street",
            "address": {
                "label": "Schillerstraße, 60313 Frankfurt am Main, Deutschland",
                "countryCode": "DEU",
                "countryName": "Deutschland",
                "stateCode": "HE",
                "state": "Hessen",
                "countyCode": "F",
                "county": "Frankfurt am Main",
                "city": "Frankfurt am Main",
                "district": "Innenstadt",
                "street": "Schillerstraße",
                "postalCode": "60313"
            },
            "position": {
                "lat": 50.1158,
                "lng": 8.67874
            },
            "distance": 4,
            "mapView": {
                "west": 8.67868,
                "south": 50.11558,
                "east": 8.67917,
                "north": 50.11681
            }
        }
    ]
}

If the end user is only looking for areas, the customer application can restrict results to type area:

GET https://revgeocode.search.hereapi.com/v1/
    revgeocode
    ?at=50.1158056,8.6786751
    &types=area
    &apiKey={YOUR_API_KEY}

The /revgeocode endpoint returns now the city "Frankfurt am Main":

{
    "items": [
        {
            "title": "Frankfurt am Main, Hessen, Deutschland",
            "id": "here:cm:namedplace:20161003",
            "resultType": "locality",
            "localityType": "city",
            "address": {
                "label": "Frankfurt am Main, Hessen, Deutschland",
                "countryCode": "DEU",
                "countryName": "Deutschland",
                "stateCode": "HE",
                "state": "Hessen",
                "countyCode": "F",
                "county": "Frankfurt am Main",
                "city": "Frankfurt am Main",
                "postalCode": "60311"
            },
            "position": {
                "lat": 50.11208,
                "lng": 8.68341
            },
            "distance": 0,
            "mapView": {
                "west": 8.47268,
                "south": 50.01526,
                "east": 8.80043,
                "north": 50.22721
            }
        }
    ]
}

Multiple values are allowed. For example, "types=address,area" limits results to addresses or areas if there isn't an address nearby, but excludes places.

Additional information

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

For an overview of types filter support by different endpoints check: Filtering results by their types.

results matching ""

    No results matching ""