I'm trying to develop a location based app using google places, but repeatedly get ZERO_RESULTS on every query.
{
"html_attributions" : [],
"results" : [],
"status" : "ZERO_RESULTS"
}
I intially tried with the URL from my code, using the the lat and lon of Atlanta, GA:
https://maps.googleapis.com/maps/api/place/search/json?location=33.7489,-84.3881&radius=50&keyword=coin|numismatic|silver|gold|dealer|pawn&sensor=false&key=
Then tried something a bit more generic and ubiquitous (Mickey D's) to no avail...
https://maps.googleapis.com/maps/api/place/search/json?location=33.7489,-84.3881&radius=50&keyword=mcdonalds&sensor=false&key=
and then even more generic. This returns results, but erroneous (somewhere in Africa)...
https://maps.googleapis.com/maps/api/place/search/json?location=33.7489,-84.3881&radius=50&type=bank&sensor=false&key=
I know my key is valid, since im not getting request denied and i know my structure is correct since I'm not getting Invalid Request. Anyone know what I'm doing wrong? Thank you in advance
I am receiving one result for the first query, zero for the second and 20 for the third. If I increase the radius from 50 meters to something a bit more realistic like 5000 meters, I receive many more results on the first two queries.
I also noticed that you are trying to filter by multiple keywords which is currently not supported by the Google Places API and is also a likely reason to reduce the number and quality of results returned.
There is a feature request for this in the Places API issue tracker here. Please click the 'star' icon to be notified of future changes, and to let us know you are interested in seeing it resolved.
You should also never post your API key publicly as it is directly linked to your Google account and you are responsible for its use. Please login to the Google APIs Console and generate a new key to avoid users stealing your key and abusing it.
I tried your query with my API key and I get no response either.
I tried to increase the radius and still no result.
I have not used the keyword before, try using type instead. I don´t think there is anything wrong with your query, the problem is that google does actually return 0 result for that query.
One possible reason is that you exceeded the limit of number of requests. Google places api has a limit of 1,000 free requests per 24 hour period. You can extend limit to 150,000 requests per 24 hour period without any payment. But you will have to add your credit card information. Google says that it is only to verify your identity, not to charge you.
If you pay, you can increase the limit more than that.
This information is added on 08/02/2017. Limits may change in time.
In my case, it's the wrong coordinates. Don't use LatLongs from Google Search. Only use the ones which are retrieved from Places API.
Adding my answer even though it's pretty late: I got zero results quite often when I was using locationbias and setting just a single point.
I ended up using circle with a radius of 2000 meters and started getting results consistently
Example: circle:radius#lat,lng, mentioned in the docs here: https://developers.google.com/maps/documentation/places/web-service/search-find-place#maps_http_places_findplacefromtext_mca-sh
Related
I was wondering if anyone has been working with this facebook-events-by-location library, because I've tried it myself and came across 2 potential problems:
The result list is too short (only about 20 items)
Some of the events are from another country (Germany) and have nothing to do with being nearby the provided location
What would you suggest that I obtain more events, and more importantly, ones that are in the nearby location?
Is there any other library like this one, or maybe there is a simpler way to directly use the Facebook Graph API and obtain more events by location?
Extra: do you need to some sort of premium (paid) account for the Facebook Graph API in order to get more results?
You can only search for Places by location, and then get the Events of those Places. That´s what the package actually does, if you take a look at the source or the Readme. The limit for Places is set to 100, and if there are only 20 Events in those 100 Places, you will not get more.
There is no API to get events by location, that package only a workaround. Also, there is no premium/paid account for the Graph API, it is just not possible (directly).
I am trying to get the arrival time parameter for the Google Distance Matrix API and I don't understand how to pass data to it. I am trying to make an app to show me what time to leave from somewhere to arrive on time to another place. Does just getting the information in the API violate their terms of usage?
example: https://maps.googleapis.com/maps/api/distancematrix/json?origins=Pawtucket+Rhode+Island&destinations=North+Attleboro+Massachusetts&arrival_time=Dec+5+2015+8+PM&key=YOUR_KEY
Although my answer is a little late for the original post, hopefully it'll still be useful to others... As per the Google Maps APIs Documentation:
arrival_time — Specifies the desired time of arrival for transit requests, in seconds since midnight, January 1, 1970 UTC. You can specify either departure_time or arrival_time, but not both. Note that arrival_time must be specified as an integer.
I suggest doing a calculation in Excel to calculate the number of seconds since 1970 - it can easily get a bit messy, so it's a shame that there's no more 'user-friendly' way to pass the date.
Additionally, I'm not certain whether the arrival_time parameter will definitely work for you - I wanted to use it myself using a call to DistanceMatrix through the JavaScript API and there, it requires a Premium Plan account, but perhaps it's okay directly through the DistanceMatrix API.
Also, the JavaScript DistanceMatrix API states that the arrival_time has to be in the future, which makes sense.
I am working on an Android app that displays a map, and when the user clicks on it, it takes the Lat/Lng and send them to my Rails server, that does the reverse_geocoding and store the address and the coordinates in the database. Then, the user can see the map with all the places around his location displayed.
I just added the functionality to create the place via the app yesterday, before that I used activeadmin directly in Rails, and everything was working fine. But yesterday, when testing my app, I suddenly got the Google API error :
Google Geocoding API error: over query limit
How is that possible ? I know there is a limit of 2500 request/day but I am far from that number, I did maybe 50 creations yesterday, in a 2 hours period.
It works again when I wait like 30 minutes or so...
For the reverse geocoding I am using Geocoder. Is that possible that Location.near does a request to Google API each time ? Normally it does not request Google servers when Lat/Lng are provided, but it checks only in the database, right ?
Or can it be my app that sends this kind of request to Google servers each time I display the map ?
I am a bit lost here...
Thanks !
Geocoding services also limit based on queries per second as well, which may be the reason for that message.
Geocoder does makes an API call every time you call Location.near("foo") (in order to get the lat/lon of the foo). In combination with geocoding your models, you may be hitting the rate limit.
You may want to try adding some retry logic when the query limit exception is called, or getting the lat/long from your Android app and pass that directly to the query, avoiding the .near geolocation.
I have an android app that is adding places to the google Places API without problem. My app also receives places added by other users.. To my dismay, I realized that when adding a place, there is no way to include an address, only a longitude and latitude. I had suspected that Google would supply an address when the place was requested, but alas, the "vincinity" value is not included in the JSON returned from good on this location.
I suppose I could take the lat and lng and subsequently geocode (reverse-geocode?.. I can't ever keep them straight) the results myself, but was wondering if there was something I was overlooking.. I have read all the Places API docs through several times.. I thought if anyone knew a little trick, they would be on this website (of course).
The 'vicinity' parameter will only be returned after the Place Report Request has been moderated.
Currently only Place Report Requests submitted from a small number of trusted applications are being moderated for integration into Google Places. We are still working on streamlining the moderation process to minimise spam, incorrect and duplicate place results.
The best option would be to reverse geocode the returned lat lng.
I have an application that generates some number of tokens around the current location of the user using a certain distance radius. The user will then have to run to some of those locations. The problem is that some tokens can be created in a lake,forest,ocean, or some other physically unreachable location. As a quick fix I just generate extra tokens and increase the proximity distance that determines if a user reached a certain location. I now want to improve this so that each token is located at a reachable location.
The only solution I have been able to come up with is using the Google Directions API to determine a path from the user to the token and use the last coordinate in the polyline as the new reachable location of the token. My problem with this is that I potentially have to post up to 30 requests to the Directions service simultaneously and I am worried that I might hit the query rate limit. I have not found anything definite about query rate limit.
So my question is whether anyone knows of a better solution or can give any input on the Directions query rate limit? Waiting 1 second between each request and forcing the user to wait up to 30 seconds is not a reasonable solution. Thanks.
UPDATE
Using the solution that I described in the question does produces an OVER_QUERY_LIMIT, even if I wait 1 second between each request. Other then that the logic was sound and tokens that got a request thru were appearing in walk reachable locations.
You can calculate the distance between two lat/lon with Location.distanceBetween(). This is a static convenience API call. There's no limit on number of calulations.
Usage limits
Use of the Google Directions API is subject to a query limit of 2,500 directions requests per day. Individual directions requests may contain up to 8 intermediate waypoints in the request.
Google Maps Premier customers may query up to 100,000 directions requests per day, with up to 23 waypoints allowed in each request.
You might want to take a look into the Maps premier customer so you don't hit the limit too fast. If your app becomes popular I bet you can get an higher limit.
One way would be to see if you can see the elevation to see if it's a cliff or not. However just seeing if it's a lake or not seems to be quite hard. Might be some kind of gps lookup service out there except Google Maps.
If you just want to know the distance between locations just use Location.distanceTo() or static distanceBetween()
Getting the info if it's a road or not is another question.
After some 8 hours I finally got something working. So using the fact that each request can have up to 8 waypoints I can technically ask directions to 9 locations in one request. Here's what I am doing now:
Generate 9 random locations at a time. Pass the locations to my DirectionsComputer which returns the polyline path that goes through all 9 coordinates as a list of coordinates. Then I pick 9 location from the path and set them as the locations of my tokens. Now all my tokens are semi-randomly generated, always appear on a road, and I only need to do 4 consecutive requests to generate 36 tokens.
There are some cases where a few tokens are bunched together. For example, the coordinates which are originally located in the ocean get moved to the same beach. But for the most part, all my tests showed the tokens spread apart and I could tweak the rest.