如何获取 TimezoneType 实例以响应此处的地理编码调用

How to obtain TimezoneType instance in response to here geocoding calls

之前已经问过类似的问题,但回答一直是使用 AdminInfo 元素中的 TimeZoneOffset。但是,这只是一个偏移量,如果您想知道实际时区是不够的。

此处记录了 TimezoneType 元素: https://developer.here.com/documentation/geocoder/topics/resource-type-response-geocode.html#resource-type-response-geocode__timezone

地理编码 API 文档 (https://developer.here.com/documentation/geocoder/topics/resource-geocode.html) 记录了 locationattributes 参数和 timeZone 选项,但这似乎没有效果。

所以问题是,是否可以使用任何 Here API 资源来获取完整的 TimezoneType 实例,如果可以,如何获取?

是的,可以获取包含所有字段的 TimezoneType 数据。您不能在查询中使用 gen=8,而必须使用 gen=9。下面是一个示例查询,其响应中提供了时区详细信息。希望这对您有所帮助!

样品请求:

http://geocoder.api.here.com/6.2/geocode.json?gen=9&jsonattributes=1&language=en-US&locationattributes=timeZone&mapview=-23.4842168%2C-46.5935476%3B-23.4967132%2C-46.573592&maxresults=20&searchtext=2215%20e%202&app_id=xxxx&app_code=xxxx

响应示例:

    adminInfo": {
        "timeZone": {
            "offset": -7200,
            "rawOffset": -10800,
            "nameShort": "BRT",
            "nameLong": "Brasilia Time",
            "nameDstShort": "BRST",
            "nameDstLong": "Brasilia Summer Time",
            "inDaylightTime": true,
            "dstSavings": 3600,
            "id": "America/Sao_Paulo"
        }
    }