2

I have read your answer on this. Maps API keys for geocoding not working anymore?

Currently I am trying this: https://maps.google.com/maps/api/geocode/json?address=n&sensor=true&key=apikeygoeshere

Giving me error:

This API project is not authorized to use this API.

Please suggest how can I complete my app. I am searching locations for my App.I can buy business plan later but for now I need to test for development. I have following services on: Google Maps Coordinate API, Google Maps Engine API, Google Maps Geolocation API, Google Maps JavaScript API v3, Google Maps SDK for iOS, Places API.

Community
  • 1
  • 1
Ragini Shukla
  • 41
  • 1
  • 2
  • 8

3 Answers3

21

What you are referring to is not the Geolocation API. It is the Geocoding API. You need to enable the Geocoding API in your console. Please see the documentation.

  1. Visit the APIs console at https://code.google.com/apis/console and log in with your Google Account.
  2. Click the Services link from the left-hand menu in the APIs Console, then activate the Geocoding API service.

Hope this helps.

MrUpsidown
  • 21,592
  • 15
  • 77
  • 131
  • Thank you. In addtion after posting this question I tried more and found 'Geocoding API'. Now it started working fine. But when I search for 'Capital Area Soccer League'. It shows no result. But when I search in google maps this have results. In url replace 'address=n' with 'address=Capital+Area+Soccer+League'. – Ragini Shukla Feb 27 '14 at 13:12
  • You are supposed to pass an address, or part of an address (a road, a locality, a country, etc.). *Capital Area Soccer League* is nothing like that. – MrUpsidown Feb 27 '14 at 15:57
  • Then How googlemaps returns 2 results. try with this url. https://www.google.co.in/maps/search/Capital+Area+Soccer+League or type 'Capital Area Soccer League' in google maps. it shows 2 results from Raleigh. – Ragini Shukla Feb 28 '14 at 07:19
  • Try a search with the [Places Library](https://developers.google.com/maps/documentation/javascript/places) and you will see the same 2 results. – MrUpsidown Feb 28 '14 at 07:59
  • Thank you. Problem solved. 'Capital Area Soccer League' is nothing, since google map have autosuggestion that's why it shows 2 location and geocoding returns for lat-long of exact input parameter. I tried geocode with both the suggestions of map and works fine. – Ragini Shukla Mar 05 '14 at 11:21
0

Try this URL, You Don't have to enter API Key in URL Just pass lat,lng in URL through a variable

http://maps.google.com/maps/api/geocode/json?latlng=-34.78,138.519&sensor=false

  • Actually when I dont use key it limits searh. It doesnot returns all the results. I am working on titanium and developing IOS app. I want to search and location from google maps in IOS device for some flow and get latitude and longitude of that location. Later on this data will be used as 'Navigate to' functionality. – Ragini Shukla Feb 27 '14 at 13:16
  • I have no idea about titanium but all i can say is that you are searching for reverse geocoding not geocoding.It gives lat,lng from postcode or other are parameters.Maybe you should Try Reverse Geocoding. – Mohammad Kamran Feb 28 '14 at 15:51
0

When you put your location (Capital Area Soccer League) in google map search, google plots the location in the map if it finds a correct geocodes but if it does not finds proper geocodes for the searched location then it shows suggestions of corrects locations in the dropdown. When you choose any of the locations from the dropdown - it has the correct lat long (geocodes) so it plots that in the map correctly.

So you should not use geocodes in the search rather open up a suggestions dropdown and when click on any of the suggested location then you have correct geocodes to plot in the map.