user3931314
user3931314

Reputation: 119

Here Maps autocomplete geocode has some strange issue with language translation

Using the here maps autocomplete.geocoder.api v6.2 and passing &language=en parameter, a search returns results with the "label" instead of English language with French language.

This is GET endpoint I'm calling with all the other parameters i use

https://autocomplete.geocoder.api.here.com/6.2/suggest.json
?query=c
&mapview=51.756414,-0.652059,51.309901,0.331888
&app_code=MY_APP_CODE
&app_id=MY_APP_ID
maxresults=15
&country=GBR
&prox=51.508530,-0.076132,30000
&language=en

The result of the above GET endpoint call is this json

{
  "suggestions": [
    {
      "label": "United Kingdom, Comté d'Oxford",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_HTKAfbquVEou80WZXdrniC",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Comté d'Oxford"
      },
      "distance": 86196,
      "matchLevel": "county"
    },
    {
      "label": "United Kingdom, Comté de Hertford",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_szH9Ci92RVY5reHH1VSa6A",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Comté de Hertford"
      },
      "distance": 26970,
      "matchLevel": "county"
    },
    {
      "label": "United Kingdom, Comté de Hampshire",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_IBS0mvpblzLbehAjAMG7.C",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Comté de Hampshire"
      },
      "distance": 114129,
      "matchLevel": "county"
    },
    {
      "label": "United Kingdom, Comté de Berk",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_n-TkgE8S4qt9kGGUkawVGB",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Comté de Berk"
      },
      "distance": 61719,
      "matchLevel": "county"
    },
    {
      "label": "United Kingdom, Comté de Buckingham",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_vX7N0mZ1b4HC5V1DXwy3iA",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Comté de Buckingham"
      },
      "distance": 75626,
      "matchLevel": "county"
    },
    {
      "label": "United Kingdom, CR0 1, Croydon",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_gbk1f7HBWIP8q34qF94w6A",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Surrey",
        "city": "Croydon",
        "postalCode": "CR0 1"
      },
      "distance": 15228,
      "matchLevel": "city"
    },
    {
      "label": "United Kingdom, London, City of London",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_OIY4l1Ys6bIUnZCJo8RQ7B",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "London",
        "city": "London",
        "district": "City of London",
        "postalCode": "EC1A 4"
      },
      "distance": 1986,
      "matchLevel": "district"
    },
    {
      "label": "United Kingdom, CR0 1, Croydon, Croydon",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_A-KWPtq3xkU9R1OFqELWpA",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Surrey",
        "city": "Croydon",
        "district": "Croydon",
        "postalCode": "CR0 1"
      },
      "distance": 15228,
      "matchLevel": "district"
    },
    {
      "label": "United Kingdom, Comté de Bedford",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_ajXmsYY9XFqUFqvj1ba7wA",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Comté de Bedford"
      },
      "distance": 47643,
      "matchLevel": "county"
    },
    {
      "label": "United Kingdom, Comté de Warwick",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_9PDEEpbiURmpFWb9vPQpeD",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Comté de Warwick"
      },
      "distance": 147331,
      "matchLevel": "county"
    },
    {
      "label": "United Kingdom, CT1 2, Canterbury",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_VD8YPCI.JUqDjxD8sP84AC",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Kent",
        "city": "Canterbury",
        "postalCode": "CT1 2"
      },
      "distance": 83989,
      "matchLevel": "city"
    },
    {
      "label": "United Kingdom, Comté de Northampton",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_zORnAshlbaC1KPrAO3l7xB",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Comté de Northampton"
      },
      "distance": 98330,
      "matchLevel": "county"
    },
    {
      "label": "United Kingdom, CT1 2, Canterbury, Canterbury",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_jqhKXfcVudUg4b2WGi6teB",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Kent",
        "city": "Canterbury",
        "district": "Canterbury",
        "postalCode": "CT1 2"
      },
      "distance": 83989,
      "matchLevel": "district"
    },
    {
      "label": "United Kingdom, Comté d'Oxford, OX3 0, Oxford, Cheney Student Village",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_Q2z9awYLuQ7mVhvrPipzjC",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Comté d'Oxford",
        "city": "Oxford",
        "district": "Oxford",
        "street": "Cheney Student Village",
        "postalCode": "OX3 0"
      },
      "distance": 84092,
      "matchLevel": "street"
    },
    {
      "label": "United Kingdom, Comté d'Oxford, OX1 3, Oxford, Catte Street",
      "language": "en",
      "countryCode": "GBR",
      "locationId": "NT_bQFSMkK5C8pdIWfOI.zTZB",
      "address": {
        "country": "United Kingdom",
        "state": "England",
        "county": "Comté d'Oxford",
        "city": "Oxford",
        "district": "Oxford",
        "street": "Catte Street",
        "postalCode": "OX1 3"
      },
      "distance": 85769,
      "matchLevel": "street"
    }
  ]
}

Notice that the "label":"United Kingdom, Comté d'Oxford" is in French language instead of the one expected that is English since I'm using the language:en parameter

Upvotes: 0

Views: 202

Answers (1)

user3505695
user3505695

Reputation:

Regarding documentation on scroll please to language parameter : The preferred language of address elements in the result.

The language parameter must be provided as 2-letter ISO language code. The plural form of the parameter (languages) is not supported and ignored. Only one language can be provided. The language setting changes the language of result elements where available in the map data. The language setting has no impact on matching or ranking and it does not express any regional preference.

The default response language is the language that is most relevant to the query.

Also, the language parameter has no impact on which results are returned because is a preferred(not required), in other words to say the "query" parameter has higher priority(has more impact on matching) unlike the "language" parameter.

Upvotes: 0

Related Questions