解决方法
谷歌可以帮助你!
https://developers.google.com/maps/documentation/geocoding/
该zip实际上被Google称为“postal_code”.
例如,假设您想获得Clarkston,MI的拉链……
http://maps.googleapis.com/maps/api/geocode/json?address=Clarkston+MI&sensor=true
返回:
- {
- "results" : [
- {
- "address_components" : [
- {
- "long_name" : "Clarkston","short_name" : "Clarkston","types" : [ "locality","political" ]
- },{
- "long_name" : "Oakland","short_name" : "Oakland","types" : [ "administrative_area_level_2",{
- "long_name" : "Michigan","short_name" : "MI","types" : [ "administrative_area_level_1",{
- "long_name" : "United States","short_name" : "US","types" : [ "country",{
- "long_name" : "48346","short_name" : "48346","types" : [ "postal_code" ]
- }
- ],"formatted_address" : "Clarkston,MI 48346,USA","geometry" : {
- "bounds" : {
- "northeast" : {
- "lat" : 42.7418310,"lng" : -83.41402409999999
- },"southwest" : {
- "lat" : 42.7252370,"lng" : -83.42880730000002
- }
- },"location" : {
- "lat" : 42.73511960,"lng" : -83.41929410
- },"location_type" : "APPROXIMATE","viewport" : {
- "northeast" : {
- "lat" : 42.74331460,"lng" : -83.40328670
- },"southwest" : {
- "lat" : 42.72692350,"lng" : -83.43530149999999
- }
- }
- },"political" ]
- }
- ],"status" : "OK"
- }
编辑
如果您没有收到第一次通话的邮政编码,则必须使用第一次通话的坐标再次拨打同一个网络服务.还是很简单 – 对史蒂文斯角,威斯康星州的呼吁如下:
http://maps.googleapis.com/maps/api/geocode/json?latlng=44.52357920000001,-89.5745630&sensor=true
您可以从“位置”获取lat / lng值.希望这可以帮助!