Bulk Canadian Postal Codes inside Google Sheet Using Google Places API - google-maps

I have a Google Sheet with 3000+ Canadian Addresses, Street, City, Province but I don't have the Postal Codes. Is there a way to look these up using Google Places API or in bulk?

I have seen Google maps/places Postal Code data not up to date many a times. The most reliable thing would be using Canada Post AddressComplete (AC). https://www.canadapost-postescanada.ca/ac/ . It may need some digging into if there are AC API's available that return correct postal code from an address.

Related

Google maps API does not return postal code for "Chile" based addresses

When I try to get the zipcode for an address using Google maps geocoding API, it works, the postal code is returned as part of the address_components array: (example:
https://maps.googleapis.com/maps/api/geocode/json?&address=socoma%201%2C%20marrakesh).
But for Chile (the country) based addresses, it does not seem to return the postal code:(example:
https://maps.googleapis.com/maps/api/geocode/json?&address=las%20condes%20santiago%20chile).
Any idea why would be much appreciated.
I've had a look at information about Las Condes area in wikipedia
https://en.wikipedia.org/wiki/Las_Condes
and figured out that the postal code for Las Condes should be 7550000:
https://worldpostalcode.com/chile/region-metropolitana-de-santiago/santiago/las-condes
Now I try to search the postal code 7550000 in Chile using the components filtering which is the recommended way for postal code lookup
https://maps.googleapis.com/maps/api/geocode/json?components=postal_code%3A7550000%7Ccountry%3ACL&key=MY_API_KEY
This request returns
{
"results":[
],
"status":"ZERO_RESULTS"
}
So, at this point it looks like the postal code 7550000 is missing from the Google database and you are experiencing a data issue. In order to fix data issue you should report it to Google following the document:
https://support.google.com/maps/answer/3094088
Hopefully, Google will add the missing postal code soon.
Google is not the answer for everything, Chile, and some other countries, has very precise postal codes.
Basically for cities, there is a postal code specific for each section of a street.
So for Las Condes, the general postal code is 7550000, but if you need the specific code for an address, you need to search on the Chile post web site
eg Acapulco street, number 3700 give postal code 7550541.
You can also use postal databases like GeoPostcodes

Google geocode API - Zero results for valid postal codes

I am working with the google goecode API and a few postal codes gets status ZERO_RESULTS even tho' the postal codes exists (when searching on the complete adress I can find it).
Here is the request I send (postal code: W1K6LX in England):
https://maps.googleapis.com/maps/api/geocode/json?components=postal_code:W1K6LX%7Ccountry:GB
So this gives ZERO_RESULTS
But when I search for the adress: Kalrock 20 North Audley Street I can clearly see "London W1K 6LX" right here: https://www.google.com/maps/place/Kalrock+Capital+Management/#51.5134013,-0.1556717,17z/data=!3m1!4b1!4m5!3m4!1s0x4876052eac174b5f:0xd76bd9d6e03653af!8m2!3d51.513398!4d-0.153483
Am I doing something wrong here?
It looks like there is a data issue here. The postal code W1K6LX seems to be missing in Google database.
First of all I can see that this is a valid postal code according to the Royalmail
As you mentioned the geocoding service returns ZERO_RESULTS, although the place 'Kalrock Capital Management' uses this postal code in the address. I suppose the place was created in Google My Business. If I understand correctly when you create a place in Google My Business you can enter a postal code as a text value and it will be stored, however the postal code feature might be missing from the database.
To check this theory I found the place 'Kalrock Capital Management' in Places API and figured out that the place ID is ChIJX0sXrC4FdkgRr1M24NbZa9c.
I executed geocoding request to get coordinates of this place ID:
https://google-developers.appspot.com/maps/documentation/utils/geocoder/#place_id%3DChIJX0sXrC4FdkgRr1M24NbZa9c
and got coordinate 51.513398,-0.153483.
Now I try to execute reverse geocode to find the nearest postal code for this coordinate:
https://maps.googleapis.com/maps/api/geocode/json?latlng=51.513398%2C-0.153483&result_type=postal_code&key=MY_API_KEY
As you can see the nearest postal code that can be found for this coordinate is W1K 6AG
I can suggest reporting the missing postal code to Google as described in the following page
https://support.google.com/maps/answer/3094045
I hope this helps!
I think there are postcodes that are in use by the post office that are not geocodeable. I've just be trying to get a geocode for the London postcode W1S 1BN using OpenStreetMap with no luck, and yet Royal Mail's https://www.royalmail.com/find-a-postcode tells me that it relates to 17 Hanover Square. Using the identical Royal Mail tool to get the postcode for 17 Hanover Square, London, I get W1S 1HU, which is geocodable. So I'm working on the assumption that the Royal Mail creates and uses some special postcodes, probably for certain businesses or business purposes, that don't map directly to a physical location in terms of a geocode.
Using the OP's example, Royal Mail reports three different postcodes for 20 North Audley Street in London, including the two mentioned.

Possible To Differentiate Between UK States - Google Maps JS API

Is it possible to differentiate between Scotland, Wales, Northern Ireland and England when retrieving data via Google Maps, via the Javascript API or otherwise?
I have looked into a few examples in Google's docs, and it seems that Google does not give an option to differentiate between the different UK constituents.
The autocomplete examples for the JS API do have a return field 'STATE' but it is seems to only be used for US states and is returned null when querying a UK address. Google just returns 'United Kingdom' for the country when querying an address in the UK.
I need to get the country name back when I query Google Maps with a postcode.
EDIT/NOTE: if you give a city/town, only, in the query then Google DOES return the UK member state in the State field. But, Google is not returning the state when I search by postcode only, which is what I need.
Any ideas?
Thanks!

how to get an administrative_area_level_1 list for a given country from google maps api?

I'm building a drill down interactive map
I want to use lists, that will enable the user to drill from continent to country to administrative_area_level_1 regions
is there a way to query google maps api and get a list of administrative_area_level_1 names for a given country?
I looked in geocoding - which gives me essentially a lat/lng coordinates for an address
also looked at reverse geocoding, that will return address components for a given lat/lng
not relevant...
i need a list of administrative_area_level_1 names for a given country...
I don't believe Google has a complete list or API for that information, but there are several resources that might be helpful:
Counties (US Census Data)
Cities (Google AdWords API
"Geographical Targets" (Google AdWords API)
That last one is ambiguous but seems to include quite a lot. You could probably filter it down to just what you need.
Unfortunately the Google Maps API does no provide this functionality. You will have to look into solutions such as the SimpleGeo Context API.

How to look up ZIP/Postal Code by City using Google Maps API?

How can I extract a Postal Code or ZIP of a place by giving Google Maps a city on the map?
Basically I'm looking for a free verification service for checking completed addresses for accurate details.
I seem to remember the maps API can somehow provide a geographical point when given an address. Now I'm searching for a slightly reversed situation in order to validate the postal code typed in with a city.
You need to Geocode the address to get best match coordinates
and then Reverse Geocode the coordinates to compare zip.