Maps API keys for geocoding not working

和自甴很熟 提交于 2019-12-10 11:33:02

问题


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.


回答1:


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.




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/22061671/maps-api-keys-for-geocoding-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!