Frage

I need to programmatically find approximate postal/zip code for a given city. When I use this link:

http://maps.googleapis.com/maps/api/geocode/xmladdress=vancouver,BC,Canada&components=country:CA

it brings me all location information except postal code. Is there a way to get a postal code using only city name?

War es hilfreich?

Lösung 2

I have looked around a lot. Ben is right. It is not possible to get postal codes by using only city names. You need full address. However you can get postal code of a coordinate. It requires too many api calls but if you have the coordinates of the city you can get the postal code easily.

Andere Tipps

Likely not, as cities can have multiple zip codes.

At least for the US, you could look at the "Hold For Pickup Facility Information" api from the USPS

https://www.usps.com/business/web-tools-apis/address-information.htm (scroll down a bit)

This returns a list of us postal facilities in a given city, from which you could glean a list of (at least some) zip codes in the area.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top