0

使用这里的地图 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"
    }
  ]
}

请注意,“label”:“United Kingdom, Comté d'Oxford”是法语,而不是预期的英语,因为我使用的是 language:en 参数

4

1 回答 1

0

关于滚动文档,请参阅语言参数:结果中地址元素的首选语言。

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

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

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

于 2020-02-19T13:23:05.607 回答