13
votes

We use Google Geocoding API to map address to Latitude and Longitude.

Here is the sample URL for encoding (which returns json) -

http://maps.googleapis.com/maps/api/geocode/json?address=Dallas&sensor=false

Message: OVER_QUERY_LIMIT

Ok, it makes sense, because we exceed over 2500 daily limit so we place API key like this -

http://maps.googleapis.com/maps/api/geocode/json?key=xxxxx&address=Dallas&sensor=false

Message: REQUEST_DENIED

I'm wondering where/how to place the API Key.

1
Just to confirm, you have an API key for a business account - not a free key for using google maps api in general?Matthew
Just to articulate this, the developer console (API) key can only be used with the Google Maps client-side APIs. The call you're making is to the Google Maps Geocoding web service API, hence the REQUEST_DENIED response.James A Webb

1 Answers

13
votes

Looks like in version 3 you need to pass the ClientID in the URL and not a key as you do in the free version: https://developers.google.com/maps/articles/v2tov3#newkey

So your URL should look like: http://maps.googleapis.com/maps/api/geocode/json?client=xxxxx&address=Dallas&sensor=false

Not lucky enough to have a paid account so I cannot test - but I think that will get you on the correct path.

Relevant from this link: https://developers.google.com/maps/documentation/business/webservices/

Client ID

You must include your client ID in all API requests. Your client ID identifies you as a Maps API for Business customer and enables support and purchased quota for your application. Requests made without a client ID are not eligible for Maps API for Business benefits.

If you're switching from the free API services to a Maps API for Business implementation, you must remove the key parameter from your requests. Google Maps API web services will deny requests made with both a client ID and a key.

More information is available in the Authentication and Authorization chapter of this guide.

If you have lost your client ID, you can recover it by logging in to the support portal and clicking Maps: Add URLs from the links on the left of the page.

EDIT

For more information, including instructions on passing your client ID to the Earth API, v2 API, and the Maps API for Flash, please read Loading Client-side APIs.

If you have lost your client ID or cryptographic key, you can recover them by logging in to the support portal and clicking Maps: Add URLs from the links on the left of the page.