简体   繁体   English

将与国家/地区相关的位置信息更改为“ ISO_3166-2:ES”代码

[英]Change Location information related with Country to “ISO_3166-2:ES” code

I am using HERE API to search for a request that gives me a Location dta object giving latitude and longitude. 我正在使用HERE API搜索请求,该请求使我得到一个提供纬度和经度的Location dta对象。

I am receiving Country information in "ISO_3166-1_alpha-3", which is ISO by default. 我在“ ISO_3166-1_alpha-3”中收到国家/地区信息,默认情况下为ISO。 What I need in my code is to distinguiss between latitude and longitude from Balears islands, Canaris Islands or rest of Spain. 我在代码中需要的是区分巴利阿里群岛,加那利群岛或西班牙其他地区的经度和纬度。

The problem that this ISO provocates me is that the country code I receive is 'ESP' and after that, I have to check in code where it comes to get Balears, Canaris or rest. 这个ISO激怒我的问题是,我收到的国家/地区代码是“ ESP”,然后,我必须检入要获取Balears,Canaris或休息的代码。

So, I have checked that "ISO_3166:ES" code would help. 因此,我检查了“ ISO_3166:ES”代码是否会有所帮助。 Looking for information in developer API guide, I have checked that you can include different params but I haven't see any param in developer API guide to specify this change and I would like to know if any of you know it. 在开发人员API指南中查找信息时,我检查过您可以包含不同的参数,但在开发人员API指南中没有看到任何参数来指定此更改,我想知道是否有人知道它。

I have search in API guide information about params. 我在API指南中搜索有关参数的信息。 I have see a related param called 'CountryCodeType' which gives me the country code according to ISO 3166-1-alpha-3, but this is just what I want to change. 我看到一个名为“ CountryCodeType”的相关参数,该参数根据ISO 3166-1-alpha-3为我提供了国家/地区代码,但这只是我要更改的内容。

The url I am using is: 我使用的网址是:

String url = https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?
app_id=[API_ID]&
app_code[API_CODE]&
mode=retrieveAreas&
prox=39.56951,2.64745&
language=es 

I expect Country with other format: 我希望国家/地区采用其他格式:

 "Location": {
    ....
        "MapView": {
              ....
              "Address": {
                 "Label": "Sant Nicolau, Palma, Islas Baleares, España",
                 "Country": **"ES-IB"**,
                 "State": "Islas Baleares",
                 "County": "Islas Baleares",
                 "City": "Palma",
                 "District": "Sant Nicolau",
                 "PostalCode": "07001",
                 "AdditionalData": [
                   --...
                 ]
             }
       }
}

the output now is: 现在的输出是:

 "Location": {
    ....
        "MapView": {
              ....
              "Address": {
                 "Label": "Sant Nicolau, Palma, Islas Baleares, España",
                 "Country": "**ESP**",
                 "State": "Islas Baleares",
                 "County": "Islas Baleares",
                 "City": "Palma",
                 "District": "Sant Nicolau",
                 "PostalCode": "07001",
                 "AdditionalData": [
                   --...
                 ]
             }
       }
}```

"ES-IB" is the code for subdivisions, but not country code: “ ES-IB”是细分的代码,但不是国家/地区代码:

ISO 3166-2:ES is the entry for Spain in ISO 3166-2, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), which defines codes for the names of the principal subdivisions (eg, provinces or states) of all countries coded in ISO 3166-1. ISO 3166-2:ES是ISO 3166-2中西班牙的条目,ISO 3166-2是国际标准化组织(ISO)发布的ISO 3166标准的一部分,该标准定义了主要分区名称的代码(例如,省或州) ) ,所有国家/地区均已按照ISO 3166-1编码。

Here API only support 3 letters country code "ESP" (by default) and 2 letters country code "ES" in the country code filed, if you want to retrieve 2 letters, please add "additionaldata=country2" in the request 这里的API仅支持3个字母的国家代码“ ESP”(默认)和2个字母的国家代码“ ES”(在国家代码字段中),如果要检索2个字母,请在请求中添加“ additionaldata = country2”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM