For an application I'm developing, I need to find the nearest bus stops using the Google Maps API. How would I accomplish this?
The place search API just returns REQUEST_DENIED, so that isn't much help.
https://maps.googleapis.com/maps/api/place/search/json?key=AIzaSyCNutXaoPSvdgAboAp7CYLZ2S5oVv_Fe7o&location=52.069858,4.291111&radius=1000&sensor=false
http://puu.sh/zUUa
I suspect that REQUEST_DENIED gives you a clue that your query is well-formed, but there is something invalid. If it's not the lack of the sensor parameter, it must be the key you provided. I don't have a key myself to test it, and Google refuses to give it saying the URL I provided is invalid... I can only suggest you to double-check your key, and maybe try with another account.
EDIT: Now I've managed to get my key and found your mistake: you forgot to put https, not http, in your request.
Related
Is it possible to link directly to street view from an URL using only the address (and not lat/lng)?
For example, is there a way to do something like
http://maps.google.com/maps?q=&layer=c&address=Street,number,state&cbp=11,0,0,0,0
Instead of
http://maps.google.com/maps?q=&layer=c&cbll=31.335198,-89.287204&cbp=11,0,0,0,0
?
Lat/lng from geocoding tends to not be recognized by street view as being too far from a street, sometimes getting the wrong street altogether, because the lat/lng it generates may be off the street, as it tries to match the location of a house.
I have looked everywhere and even tried playing with google's URLs on my own, but I can't find anything on it. Most sources won't even mention address. I'm currently using the url sample from this question, but it still isn't really what I'm looking for.
If this is really not possible, could someone link to a source/documentation where it says so?
Edit: Thank you everyone for the answers, but none really address the issue with street view and addresses. I'll look into forwarding this to google. I'll post here if I get a reply.
Let's enhance your code, if you paste the code in browser then you will be redirect to google maps and will show result what you requested.
http://maps.google.com/maps?&q=Space+Needle,Seattle+WA
If you would like to pass the value (address) via php or any other code type then simply it will not work, you cannot use google maps without API to enhance your requirement. Lat & Lng is basic practice to show map and not require any api, but if you would like to pass additional properties then you will have to use google maps api to do so. Detailed documentation can be found here
https://developers.google.com/maps/documentation/embed/guide
but let's try an example try this code in browser
https://www.google.com/maps/embed/v1/place?q=Mumbai,+Maharashtra,+India
You will get an error that api key not found but if you try this one
https://www.google.com/maps/embed/v1/place?key=AIzaSyD4iE2xVSpkLLOXoyqT-RuPwURN3ddScAI&q=Space+Needle,Seattle+WA
Then you will get output. Hope it helps!
First reverse geocode to find the lat lng using another Google Service API.
Then feed the resulting lat lng into the streetview endpoint parameter.
The tutorial for Google maps API states that an API key is required for making calls to the API. The example given on the page however does not use an API key. So why would'nt someone choose to make the call without an API key and not worry about exceeding any limits?
Thanks,
Yash
Since version 3 you the API key is not mandatory anymore. You still can provide one though to track your usage because the limit still exists. See also this answer.
I am new to google map api. I copied the Hello_World.html from google maps javascript v3 getting started. But I always get the error message: the provided key is not a valid google api key.
I tried a few things but none of them worked. The following is what I did:
I edited the allowed referrers to mysite.com/* and localhost/*. But the error message is still there.
I tried a method someone suggested, which adds javascript version number:
change src="https://maps.googleapis.com/maps/api/js?key={XXX....X}&sensor=true" to src="https://maps.googleapis.com/maps/api/js?v=3.6key={XXX....X}&sensor=true", even so, the error message is still there.
Can someone give me any suggestions?
You do not need a key for Google Maps API v3, see the documentation. Your API v2 key will not work.
You will only need key for API v3 in case you want some additional features (very high traffic site, additional statistics etc.). But this is a very rare case.
You don't need a key, it should work without it. If you provided the key you are using (it isn't secret and can't be used on domains that you don't allow), we could tell if it is at least the correct format.
This
src="https://maps.googleapis.com/maps/api/js?v=3.6key={XXX....X}&sensor=true
is incorrect.
it is missing an & between the v=3.6 and "key".
version 3.6 is no longer available, that will result in the "frozen version", currently version 3.11.
I had this problem. The solution is:
Go to https://code.google.com/apis/console -> api access
Click "Key for browser apps".
The example says to enter *.example.com/* but it doesn't work for me. I had to enter (one per line):
example.com
*.example.com
*.example.com/*
example.com/*
Hope this helps
I am looking into the Google Places Autocompleter. It works perfectly, I tried using the code provided.
However I see they mention something about limits per API key. First of all, I don't have an API key, and it works. I dont see a limit regarding no API keys?
Secondly, do they limit per client IP (the browser that is viewing my site), per domain, or something else?
If they limit per domain, will sub1.domain.com and sub2.domain.com share the same limit?
I can't seem to find anything regarding this in the Google documentation, which is why I am asking here. Thanks!
Edit: So I signed up for an API key, but they dont tell me where to include it to use the Places Autocomplete?
The Google Maps JavaScript API V3 Places Library does not require an API key to implement and does not have a documented limit. However, if a user performs more queries than deemed acceptable by Google in one minute, they will receive the OVER_QUERY_LIMIT status in response to a request.
As far as the key is concerned, it's only required for the Places web service: https://developers.google.com/maps/documentation/places/
Your doc link is to the Places library - that's a service of the JavaScript API v3. A key isn't required there, though you can include one by adding &key={yourkey} when you load the Maps JS (https://developers.google.com/maps/documentation/javascript/tutorial#HelloWorld).
So:
Places web service: key required
Places JavaScript service: no key required
I don't know about specific autocomplete limits, but the JS API has limits mentioned here: https://developers.google.com/maps/documentation/javascript/usage. Basically, 25,000 map loads per day, with the option to purchase more if required.
Hope that helps.
I have a server application that calls the google maps geocoding API at http://maps.googleapis.com/maps/api/geocode/json
I experience that when the server application invokes such an URL, the response is sometimes ZERO_RESULTS.
If I take the exact same URL and paste in a browser, I get a valid result back.
Any ideas to what differences can cause this? HTTP headers? Something else?
In the link you provided it is missing the address, components, latlng or place_id parameters, besides the Google Map API KEY.
You need at least one of the parameters and the Key to get a proper response.
e.g.
https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJ1xwGTLE1K4gRmzFDd_1HzPc&key=xxx
Just add your KEY and it should work.