0

We are using the places/search endpoint to look up addresses.

Being based in Ontario, a lot of addresses have French and English version.

For example, looking for 360 Lisgar Ottawa, on will return 2 addresses in French and 2 in English (https://places.demo.api.here.com/places/v1/discover/search?at=45%2C-75&q=360+Lisgar%2C+Ottawa%2C+on&addressFilter=countryCode%3DCAN&Accept-Language=en%3Bq%3D1%2Cfr%3Bq%3D0.1&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg).

We have been trying all kinds of combination of the "Accept-Language" header parameters, with different values and weight, and it always returns the 4 values. Is there any other way to only get the addresses in French or English?

We could filter in our code after, if there was any language field on the address returned, but we couldn't find any reference about it in the documentation. Is there any ways to do it?

Thanks, Rene

  • Would help if you posted some code. – Milo Jan 24 '18 at 18:54
  • 1
    Well, we are still in exploratory phase, we thought it was related to our code, and couldn't find anything wrong, so we went back to testing the API using the demo API proposed by Here, were you can specify the header parameters. The links I have posted is the actual query we are trying to get working. The language / technology shouldn't be a factor at this point, we think that the API doesn't support it, but there is no real support page for Here API, StackOverflow seems to be the only option. – Rene Villeneuve Jan 25 '18 at 19:32

2 Answers2

0

The Accept-Language header is used in the here-api to indicate preference for language. However, if we have no translation/transliteration for a result in that language, we use a fallback mechanism where we try to return results in a language that would be intelligible to the user. In your case, I suspect that there are only French entries for some of the addresses and only English entries for others, which is why you get the same results no matter what you set the "Accept-Language" header to. There's no way to filter results so that if we don't have a translation in your preferred language then we don't return the result at all.

rollstuhlfahrer
  • 3,988
  • 9
  • 25
  • 38
Heidi Fox
  • 11
  • 2
  • In our case, the funny thing is that it returns 4 entries (you can try it by clicking on the link in the original post). The first two are French version of the last 2. I guess they are not marked in system as "French" even though they are, which might be why it doesn't work and seem to ignore the parameter. – Rene Villeneuve Feb 05 '18 at 14:58
0

This might be worth trying as I can specify the language using the HERE Geocoder REST API by adding a parameter (the same format as the Google API) at the end:
&language=en
or
&language=ar

I work in Dubai so my other desired language is Arabic. See examples below.

Example REST API Call for English

https://geocoder.cit.api.here.com/6.2/geocode.json?app_id={your app id}&app_code={your app code}&searchText=1 Prince Fawaz St, Al Khobar&language=en

Example extract from the JSON return

                        "Address": {
                            "Label": "1 Prince Ahmad Street, Madinat Al Ummal, 34441 Al Khobar, Saudi Arabia",
                            "Country": "SAU",
                            "County": "Eastern Province",
                            "City": "Al Khobar",
                            "District": "Madinat Al Ummal",
                            "Street": "Prince Ahmad Street",
                            "HouseNumber": "1",
                            "PostalCode": "34441",
                            "AdditionalData": [
                                {

Example REST API Call for Arabic

https://geocoder.cit.api.here.com/6.2/geocode.json?app_id={your app id}&app_code={your app code}&searchText=1 Prince Fawaz St, Al Khobar&language=ar

Example extract from JSON return

                        "Address": {
                            "Label": "\u202e\u202a1\u202c شارع الأمير أحمد, مدينة العمال, \u202a34441\u202c الخبر, السعودية\u202c",
                            "Country": "SAU",
                            "County": "المنطقة الشرقية",
                            "City": "الخبر",
                            "District": "مدينة العمال",
                            "Street": "شارع الأمير أحمد",
                            "HouseNumber": "1",
                            "PostalCode": "34441",
                            "AdditionalData": [
                                {
Rich B
  • 1