Google Maps Geocode API js v3 – Status = “REQUEST_DENIED”

There a few things that could be going on here.

#1 Do you need a map key for this. If you do, you need to follow the instructions here :

https://developers.google.com/maps/documentation/javascript/tutorial?hl=en-CA#api_key

Make sure you add it where you are calling the JS API

#2 Do you have &sensor= (true or false) . Google says this is a common reason why you would get a “REQUEST_DENIED”.

https://developers.google.com/maps/documentation/geocoding/#StatusCodes

#3 Do you need to URL encode? I had a string coming in with the “#” character. Something like “R.R.#1″. It seems that the “#” is not something google likes. It rejected that entry and I was not able to geocode the address eventhough everything seemed a-ok.

Fix in C#

qParam = address + ",+" + city + ",+" + prov + ",+" + country;

        qParam = qParam.Replace(" ", "+");
		string googleUrl = "http://maps.googleapis.com/maps/api/geocode/json?address=";
		googleUrl += Server.UrlEncode(qParam) + "&sensor=false";

 

Nota Bene :  Postal Codes didn’t seem to help my google map geocode queries. I removed it from my parameters.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s