Google Maps API Geocode Postal Code and set Country code?

后端 未结 2 762
星月不相逢
星月不相逢 2021-02-05 12:53

I\'m using this API call to Google Maps to get the latitude and longitude of a postal code

http://maps.googleapis.com/maps/api/geocode/json?address=2340&sensor=false

2条回答
  •  耶瑟儿~
    2021-02-05 13:23

    The correct way to do this is not via region biasing but rather using component filtering:

    http://maps.google.com/maps/api/geocode/json
        ?components=country:AU|postal_code:2340
        &sensor=false
    

    Some demonstrations:

    • 2340
    • 93274

    Please note that if you use the components parameter, you don't need to specify the address parameter.

提交回复
热议问题