Reputation: 11
I am passing a Canadian Postal Code and expecting to receive the corresponding Province and City/Town. For the most part it is working, the Province is returned. However, there are times that the correct city or no city are returned.
Example: Postal Code N0L0B2 corresponds to Glencoe, Ontario. However, GeoCode API does not return any city.
https://maps.googleapis.com/maps/api/geocode/json?address=N0L0B2®ion=CA&key=KEY_VALUE
T0H 2N2: Corresponds to Northern Sunrise County but API returns Clairmont.
Question 1: Am I invoking API correctly by passing postal code only? That's the only piece of info that I have.
Thanks,
Jesse
Upvotes: 1
Views: 4625
Reputation: 71
Very limited experimentation here, but it looks like the first 3 characters of the postal code, at least in combination with a country code, may work where the full 6-character does not. E.g. components postal_code:V5K 0A1|country:CAN
or postal_code:V5K0A1|country:CAN
looks to be returning 0 results, but components postal_code:V5K|country:CAN
returns Vancouver.
Upvotes: 0
Reputation: 929
Here you go:
https://geocoder.ca/T0H 2N2?json=1
{
"standard": {
"prov": "AB",
"city": "Northern Sunrise County",
"confidence": "0.3"
},
"Dissemination_Area": {
"adauid": "48170016",
"dauid": "48170258"
},
"longt": "-117.237547",
"TimeZone": "America\/Edmonton",
"postal": "T0H2N2",
"AreaCode": "587",
"latt": "55.956189"
}
Upvotes: 4