0

I am trying to filter only cities in HERE Map's autocomplete API. I read on their documentation that there is matchLevel parameter...

However, nothing changes if I include it.

This is my call:

http://autocomplete.geocoder.api.here.com/6.2/suggest.json?app_id=MY_APP_ID&app_code=MY_APP_CODE&matchLevel=city&query=New York

I still get responses which are not city type.

{
    "suggestions": [
        {
            "label": "United States, New York",
            "language": "en",
            "countryCode": "USA",
            "locationId": "NT_rNsDLtnazM.kjVC-K6YWOA",
            "address": {
                "country": "United States",
                "state": "New York"
            },
            "matchLevel": "state"
        },
        {
            "label": "United States, New York, New York, New York",
            "language": "en",
            "countryCode": "USA",
            "locationId": "NT_YpQcXqbaOb.I4m5EW8BHEC",
            "address": {
                "country": "United States",
                "state": "New York",
                "county": "New York",
                "city": "New York",
                "postalCode": "10007"
            },
            "matchLevel": "city"
        },
        {
            "label": "United States, New York, New York",
            "language": "en",
            "countryCode": "USA",
            "locationId": "NT_ABhedB4xGEL83YY5az47iD",
            "address": {
                "country": "United States",
                "state": "New York",
                "county": "New York"
            },
            "matchLevel": "county"
        },
    ...

Any help is appreciated.

harunB10
  • 4,823
  • 15
  • 63
  • 107

1 Answers1

0

matchLevel is a response field, not a query parameter.

use postprocessing of the answer, like array.filter() to keep only elements of the answer which match "city"

DevBab
  • 859
  • 7
  • 13