Google通过邮政编码获取所有街道号码

时间:2018-02-18 12:23:20

标签: javascript json google-maps-api-3

我正在使用以下google api来返回详细信息! https://maps.googleapis.com/maps/api/geocode/json?address=M419AT

输出:

{
"results" : [
  {
     "address_components" : [
        {
           "long_name" : "M41 9AT",
           "short_name" : "M41 9AT",
           "types" : [ "postal_code" ]
        },
        {
           "long_name" : "Stephen Street",
           "short_name" : "Stephen St",
           "types" : [ "route" ]
        },
        {
           "long_name" : "Urmston",
           "short_name" : "Urmston",
           "types" : [ "locality", "political" ]
        },
        {
           "long_name" : "Manchester",
           "short_name" : "Manchester",
           "types" : [ "postal_town" ]
        },
        {
           "long_name" : "Greater Manchester",
           "short_name" : "Greater Manchester",
           "types" : [ "administrative_area_level_2", "political" ]
        },
        {
           "long_name" : "England",
           "short_name" : "England",
           "types" : [ "administrative_area_level_1", "political" ]
        },
        {
           "long_name" : "United Kingdom",
           "short_name" : "GB",
           "types" : [ "country", "political" ]
        }
     ],
     "formatted_address" : "Stephen St, Urmston, Manchester M41 9AT, UK",
     "geometry" : {
        "bounds" : {
           "northeast" : {
              "lat" : 53.4485883,
              "lng" : -2.3455666
           },
           "southwest" : {
              "lat" : 53.4477573,
              "lng" : -2.347262
           }
        },
        "location" : {
           "lat" : 53.4480395,
           "lng" : -2.3461457
        },
        "location_type" : "APPROXIMATE",
        "viewport" : {
           "northeast" : {
              "lat" : 53.4495217802915,
              "lng" : -2.345065319708498
           },
           "southwest" : {
              "lat" : 53.44682381970851,
              "lng" : -2.347763280291502
           }
        }
     },
     "place_id" : "ChIJWySxSBmse0gRnPi3pOSDWvg",
     "types" : [ "postal_code" ]
  }
 ],
 "status" : "OK"
}

但是是否可以归还所有的房屋/街道号码?通过邮政编码搜索列表,例如

  1. 史密斯街,城镇,城市
  2. 史密斯街,城镇,城市
  3. 史密斯街,城镇,城市
  4. 史密斯街,城镇,城市 等...
  5. 我知道Google上有自动完成功能 - 但我不想这样 - 我只想创建一个用户输入邮政编码的文本框,并列出街道号码。

    我正在收集收集这些数据的请求。

    非常感谢

1 个答案:

答案 0 :(得分:0)

我认为谷歌仍然没有这样做。从三年前看到这个问题:

use Google geocode to return street name and list of house numbers using php

但是,对于本网站上的例子,这是可能的:

https://getaddress.io

返回:

{
  "latitude": 53.4482322,
  "longitude": -2.3464489,
  "addresses": [
    "1 Stephen Street, , , , Urmston, Manchester, ",
    "2 Stephen Street, , , , Urmston, Manchester, ",
    "3 Stephen Street, , , , Urmston, Manchester, ",
    "4 Stephen Street, , , , Urmston, Manchester, ",
    "5 Stephen Street, , , , Urmston, Manchester, ",
    "6 Stephen Street, , , , Urmston, Manchester, ",
    "7 Stephen Street, , , , Urmston, Manchester, ",
    "8 Stephen Street, , , , Urmston, Manchester, ",
    "9 Stephen Street, , , , Urmston, Manchester, ",
    "10 Stephen Street, , , , Urmston, Manchester, ",
    "11 Stephen Street, , , , Urmston, Manchester, ",
    "12 Stephen Street, , , , Urmston, Manchester, ",
    "13 Stephen Street, , , , Urmston, Manchester, ",
    "14 Stephen Street, , , , Urmston, Manchester, ",
    "15 Stephen Street, , , , Urmston, Manchester, ",
    "16 Stephen Street, , , , Urmston, Manchester, ",
    "17 Stephen Street, , , , Urmston, Manchester, ",
    "18 Stephen Street, , , , Urmston, Manchester, ",
    "20 Stephen Street, , , , Urmston, Manchester, ",
    "22 Stephen Street, , , , Urmston, Manchester, ",
    "24 Stephen Street, , , , Urmston, Manchester, ",
    "26 Stephen Street, , , , Urmston, Manchester, ",
    "28 Stephen Street, , , , Urmston, Manchester, "
  ]
}

可能还有其他服务也是如此。皇家邮政每天还为您提供50个地址:

https://www.poweredbypaf.com