我正在与HERE地理编码器一起工作,发现在使用strictlanguagemode = true时,AlternativeAttributes中返回的值始终显示相同的“键”,并混合了多个级别对象的替代名称。
例如,此请求:
https://geocoder.api.here.com/6.2/geocode.json?app_id=....&app_code=....&language=en&strictlanguagemode=true&country=Spain&city=Palma
返回此响应(如您所见,所有AlternativeAttributes都使用“ Key”:“ city”,但是响应中混合了州,县和城市的备用名称:
{
"Response": {
"MetaInfo": {
"Timestamp": "2019-04-16T15:50:30.385+0000"
},
"View": [
{
"_type": "SearchResultsViewType",
"ViewId": 0,
"Result": [
{
"Relevance": 1,
"MatchLevel": "city",
"MatchQuality": {
"Country": 1,
"City": 1
},
"Location": {
"LocationId": "NT_It18KKa.DRNOAE.IP7p2rD",
"LocationType": "point",
"DisplayPosition": {
"Latitude": 39.57149,
"Longitude": 2.64694
},
"NavigationPosition": [
{
"Latitude": 39.57149,
"Longitude": 2.64694
}
],
"MapView": {
"TopLeft": {
"Latitude": 39.65717,
"Longitude": 2.56391
},
"BottomRight": {
"Latitude": 39.50374,
"Longitude": 2.84777
}
},
"Address": {
"Label": "Palma, Balearic Islands, Spain",
"Country": "ESP",
"State": "Balearic Is",
"County": "Balearic Islands",
"City": "Palma",
"PostalCode": "07012",
"AlternativeAttributes": [
{
"Key": "city",
"Value": "Illes Balears",
"Type": "baseName",
"Language": "CAT"
},
{
"Key": "city",
"Value": "Balear Uharteak",
"Semantics": "exonym",
"Language": "BAQ"
},
{
"Key": "city",
"Value": "Bale\u00e1rsk\u00e9 Ostrovy",
"Semantics": "exonym",
"Language": "CZE"
},
{
"Key": "city",
"Value": "Balearerne",
"Semantics": "exonym",
"Language": "DAN"
},
{
"Key": "city",
"Value": "Balearen",
"Semantics": "exonym",
"Language": "DUT"
},
{
"Key": "city",
"Value": "Baleaarit",
"Semantics": "exonym",
"Language": "FIN"
},
{
"Key": "city",
"Value": "Iles Bal\u00e9ares",
"Semantics": "exonym",
"Language": "FRE"
},
{
"Key": "city",
"Value": "Balearische Inseln",
"Semantics": "exonym",
"Language": "GER"
},
{
"Key": "city",
"Value": "Isole Baleari",
"Semantics": "exonym",
"Language": "ITA"
},
{
"Key": "city",
"Value": "Illes Balears",
"Semantics": "exonym",
"Language": "MAY"
},
{
"Key": "city",
"Value": "Balearene",
"Semantics": "exonym",
"Language": "NOR"
},
{
"Key": "city",
"Value": "Baleary",
"Semantics": "exonym",
"Language": "POL"
},
{
"Key": "city",
"Value": "Ilhas Baleares",
"Semantics": "exonym",
"Language": "POR"
},
{
"Key": "city",
"Value": "\u0411\u0430\u043b\u0435\u0430\u0440\u0441\u043a\u0438\u0435 \u041e\u0441\u0442\u0440\u043e\u0432\u0430",
"Semantics": "exonym",
"Language": "RUS"
},
{
"Key": "city",
"Value": "Islas Baleares",
"Semantics": "exonym",
"Language": "SPA"
},
{
"Key": "city",
"Value": "Balearerna",
"Semantics": "exonym",
"Language": "SWE"
},
{
"Key": "city",
"Value": "Balearske Ostrovy",
"Semantics": "exonym",
"Language": "CZX"
},
{
"Key": "city",
"Value": "Baleary",
"Semantics": "exonym",
"Language": "POX"
},
{
"Key": "city",
"Value": "Balearskie Ostrova",
"Semantics": "exonym",
"Language": "RUX"
},
{
"Key": "city",
"Value": "Illes Balears",
"Type": "baseName",
"Language": "CAT"
},
{
"Key": "city",
"Value": "Balearen",
"Semantics": "exonym",
"Language": "DUT"
},
{
"Key": "city",
"Value": "Iles Bal\u00e9ares",
"Semantics": "exonym",
"Language": "FRE"
},
{
"Key": "city",
"Value": "Balearische Inseln",
"Semantics": "exonym",
"Language": "GER"
},
{
"Key": "city",
"Value": "Isole Baleari",
"Semantics": "exonym",
"Language": "ITA"
},
{
"Key": "city",
"Value": "Balearene",
"Semantics": "exonym",
"Language": "NOR"
},
{
"Key": "city",
"Value": "Ilhas Baleares",
"Semantics": "exonym",
"Language": "POR"
},
{
"Key": "city",
"Value": "Islas Baleares",
"Semantics": "exonym",
"Language": "SPA"
},
{
"Key": "city",
"Value": "Balearerna",
"Semantics": "exonym",
"Language": "SWE"
},
{
"Key": "city",
"Value": "Palma",
"Type": "baseName",
"Language": "CAT"
},
{
"Key": "city",
"Value": "Palma de Mallorca",
"Type": "baseName",
"Semantics": "synonym",
"Language": "CAT"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "BAQ"
},
{
"Key": "city",
"Value": "\u5e15\u5c14\u9a6c",
"Semantics": "exonym",
"Language": "CHI"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "CZE"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "DAN"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "DUT"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "FIN"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "FRE"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "GER"
},
{
"Key": "city",
"Value": "\u03a0\u03ac\u03bb\u03bc\u03b1",
"Semantics": "exonym",
"Language": "GRE"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "ITA"
},
{
"Key": "city",
"Value": "\ud314\ub9c8",
"Semantics": "exonym",
"Language": "KOR"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "MAY"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "NOR"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "POL"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "POR"
},
{
"Key": "city",
"Value": "\u041f\u0430\u043b\u044c\u043c\u0430",
"Semantics": "exonym",
"Language": "RUS"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "SPA"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "SWE"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "CZX"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "GRX"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "KOX"
},
{
"Key": "city",
"Value": "Palma",
"Semantics": "exonym",
"Language": "POX"
},
{
"Key": "city",
"Value": "Pa Er Ma",
"Semantics": "exonym",
"Language": "PYN"
},
{
"Key": "city",
"Value": "Pal'ma",
"Semantics": "exonym",
"Language": "RUX"
}
],
"AdditionalData": [
{
"value": "Spain",
"key": "CountryName"
},
{
"value": "Balearic Islands",
"key": "StateName"
},
{
"value": "Balearic Islands",
"key": "CountyName"
}
]
}
}
}
]
}
]
}
}
这是AlternativeAttributes响应中的错误吗? 在这种情况下,如何区分州,县和市的替代名称?
谢谢!
答案 0 :(得分:0)
当选项strictlanguagemode设置为true时,Geocoder API现在会返回带有不同关键字的外来名称结果,分别是城市,国家,州和县。
快乐编码!