Akrion
Akrion

Reputation: 18525

HERE autocomplete API exclude result types (street, houseNumber etc)

HERE autocomplete API request when made on 9535 returns 5 results which all match on result type street instead of postalCode as they do with Google Maps by default. e.g.

https://autocomplete.geocoder.cit.api.here.com/6.2/suggest.json?app_code=MYAPPID&app_id=MYAPPCODE&country=USA&query=9535

{
  "label": "United States, ID, Elk City, NF-9535",
  "language": "en",
  "countryCode": "USA",
  "locationId": "NT_OA7lb1uPsSru.j2wCzrKCC",
  "address": {
    "country": "United States",
    "state": "ID",
    "county": "Idaho",
    "city": "Elk City",
    "street": "NF-9535",
    "postalCode": "83525"
  },
  "matchLevel": "street"
}

Is there a way to make HERE maps autocomplete API exclude specific result types or on the flip side is there a way to only include specific types?

Currently areas does not work for me since I need as I said 9535 to return result types of postalCode instead of street but I want 2300 Maple to still match street types.

I know we can prefix the 9535 with ca 9535 and then the expected results are returned:

{
  "label": "United States, CA, Stanislaus, 95350, Modesto",
  "language": "en",
  "countryCode": "USA",
  "locationId": "NT_-8QfFb8eUnn6Kb1FGJPYKD",
  "address": {
    "country": "United States",
    "state": "CA",
    "county": "Stanislaus",
    "city": "Modesto",
    "postalCode": "95350"
  },
  "matchLevel": "postalCode"
}

But that is not a very good option since the majority of the users would expect the Google Maps behavior.

Is there a ranking on the result types maybe?

Upvotes: 3

Views: 1175

Answers (1)

user3505695
user3505695

Reputation:

yes there is a brand new beta feature for Autocomplete. Please add the &resultType=postalcode in combination with the country=USA That should help give only postal codes.

E.g.

http://autocomplete.geocoder.api.here.com/6.2/suggest.json?app_id=[add your app_id]&app_code=[add your app_code]&query=9535&language=de&resultType=postalcode&country=USA

We will update the documentation concerning this topic soon.

Upvotes: 1

Related Questions