Maps API keys for geocoding not working

痞子三分冷 提交于 2019-12-06 05:56:36

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.

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.

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

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