在这里,地图自动填充地理编码在语言翻译方面存在一些奇怪的问题

时间:2019-06-05 21:32:58

标签: here-api here-maps-rest

使用此处的地图autocomplete.geocoder.api v6.2并传递&language = en参数,搜索将返回带有“标签”的结果,而不是带有法语的英语。

这是我正在使用的所有其他参数调用的GET端点

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

上述GET端点调用的结果是此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"
    }
  ]
}

请注意,“标签”:“英国,牛津大学”使用的是法语,而不是预期的英语,因为我使用的是language:en参数

1 个答案:

答案 0 :(得分:0)

关于scroll please to language parameter的文档:结果中地址元素的首选语言。

language参数必须以2个字母的ISO语言代码形式提供。不支持并忽略参数(语言)的复数形式。只能提供一种语言。语言设置会更改结果元素在地图数据中可用的语言。 语言设置对匹配或排名没有影响,并且不表示任何地区偏好。

默认响应语言是与查询最相关的语言。

此外,由于它是首选参数(不是必需的),语言参数对返回结果没有影响,换句话说,与“语言”不同,“查询”参数具有更高的优先级(对匹配有更大影响)参数。

相关问题