我需要从给定的美国邮编中获取城市,但是像布鲁克林这样的区域让我很困扰。
我正在使用地理编码: https://maps.googleapis.com/maps/api/geocode/json?address=11214&key=KEY 它返回以下结果。
我需要一种方法将其与纽约市相关联,我看到的唯一提示是:
也许有一种方法将布鲁克林作为纽约市的子地区链接起来,但我找不到它。
我正在使用地理编码: https://maps.googleapis.com/maps/api/geocode/json?address=11214&key=KEY 它返回以下结果。
{
"address_components": [
{
"long_name": "11214",
"short_name": "11214",
"types": [
"postal_code"
]
},
{
"long_name": "Brooklyn",
"short_name": "Brooklyn",
"types": [
"political",
"sublocality",
"sublocality_level_1"
]
},
{
"long_name": "Kings County",
"short_name": "Kings County",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"long_name": "New York",
"short_name": "NY",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"long_name": "United States",
"short_name": "US",
"types": [
"country",
"political"
]
}
],
"formatted_address": "Brooklyn, NY 11214, USA",
"geometry": {
"bounds": {
"northeast": {
"lat": 40.6163139,
"lng": -73.98259999999999
},
"southwest": {
"lat": 40.5788159,
"lng": -74.014775
}
},
"location": {
"lat": 40.6046106,
"lng": -73.9982756
},
"location_type": "APPROXIMATE",
"viewport": {
"northeast": {
"lat": 40.6163139,
"lng": -73.98259999999999
},
"southwest": {
"lat": 40.5788159,
"lng": -74.014775
}
}
},
"place_id": "ChIJLzmMV-BawokR4tFzc3LaBFI",
"types": [
"postal_code"
]
}
我需要一种方法将其与纽约市相关联,我看到的唯一提示是:
"long_name": "Brooklyn",
"short_name": "Brooklyn",
"types": [
"political",
"sublocality",
"sublocality_level_1"
]
也许有一种方法将布鲁克林作为纽约市的子地区链接起来,但我找不到它。