如何对城市的时区进行反向地理编码 - Amazon Location Service

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

如何对城市的时区进行反向地理编码

您可以使用反向地理编码 API 来请求时区信息,例如 UTC 偏移量和时区名称

潜在用途

对时区进行地理编码的可能用途:

  • 创建世界时钟

  • 在不同地区安排会议

示例

根据时区请求对东京的地点进行反向地理编码。

Sample request
{ "QueryPosition": [ 139.69172, 35.6895 ], "AdditionalFeatures": [ "TimeZone" ] }
Sample response
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointAddress", "Title": "〒160-0023 東京都新宿区西新宿2丁目8-1", "Address": { "Label": "〒160-0023 東京都新宿区西新宿2丁目8-1", "Country": { "Code2": "JP", "Code3": "JPN", "Name": "日本" }, "Region": { "Name": "東京都" }, "SubRegion": {}, "Locality": "新宿区", "SubDistrict": "西新宿", "PostalCode": "160-0023", "Block": "2丁目", "SubBlock": "8", "AddressNumber": "1" }, "Position": [ 139.69171, 35.68949 ], "Distance": 1, "MapView": [ 139.69071, 35.68861, 139.69251, 35.69048 ], "AccessPoints": [ { "Position": [ 139.69206, 35.68954 ] } ], "TimeZone": { "Name": "Asia/Tokyo", "Offset": "+09:00", "OffsetSeconds": 32400 } } ] }
cURL
curl --request POST \ --url 'https://places.geo.eu-central-1.amazonaws.com/v2/reverse-geocode?key=Your_Key' \ --header 'Content-Type: application/json' \ --data '{ "QueryPosition": [ 139.69172, 35.6895 ], "AdditionalFeatures": [ "TimeZone" ] }'
AWS CLI
aws geo-places reverse-geocode --key ${YourKey} --query-position 139.69172 35.6895 --additional-features "TimeZone"