0

How to get an address based on the postal code? Which api should I call? I didn't find the answer from google map platform。enter image description here

Geocoder can't get the detail address

Sasikumar Murugesan
  • 4,412
  • 10
  • 51
  • 74
zhu.px
  • 11
  • 1
  • 4
    A postal code by itself does not usually determine an address (there are a few exceptions), but it is the usually the other way around, i.e. you start with an address then get its postal code back from the API. – Tim Biegeleisen Aug 06 '18 at 06:31
  • Most apps in Singapore have this feature, based on the postal code to get the address, they can correspond to a specific street or community. – zhu.px Aug 06 '18 at 06:36
  • 1
    Aha! Now your question makes sense. So this may work in Singapore, but not necessarily in other places. In the US, for example, the 5 digit ZIP code can cover a large area, and even 5 ZIP + 4 at the end might not mean just one address. – Tim Biegeleisen Aug 06 '18 at 06:38
  • you can check https://stackoverflow.com/questions/3641304/get-latitude-and-longitude-using-zipcode Hope it works for you – Neha Chauhan Aug 06 '18 at 06:45
  • Aha,its not working,Do you have better approach? – zhu.px Aug 06 '18 at 07:45

2 Answers2

0

Try this API for fetching address based on pincode.

http://maps.googleapis.com/maps/api/geocode/json?components=postal_code:90210&sensor=false

Android
  • 1,420
  • 4
  • 13
  • 23
0

Like others pointed out, in some cases there is a one to one correspondence between an address and a post code, like in Singapore where you can use geocode.xyz to convert between them: https://geocode.xyz/508260?region=SG

For USA, you need a zip+4 postal code, for example: https://geocoder.ca/10005-1971?geoit=xml

<standard>
<stnumber>4</stnumber>
<staddress>Wall St</staddress>
<city>New York</city>
<prov>NY</prov>
<postal>10005-1971</postal>
<confidence>0.5</confidence>
</standard>
Ervin Ruci
  • 829
  • 6
  • 10