What's wrong with this Google Places (radar search) request? - google-maps

I'm trying to get a list of 200 gyms in Washington, D. C. within the radius of 50000 meters.
For this purpose, I issue following request to Google Places API (radar search):
https://maps.googleapis.com/maps/api/place/radarsearch/json?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&location=38.895111,-77.036667&radius=50000.000000&sensor=false&type=gym
I get an error message:
{
"html_attributions" : [],
"results" : [],
"status" : "INVALID_REQUEST"
}
What exactly is wrong with that request?

Change type=gym to types=gym, that worked for me

Related

How to get the AutoComplete country list and country code list from Google places?

I am trying to run the following API call.n I am following the API DOC here - https://developers.google.com/maps/documentation/places/web-service/autocomplete#types
https://maps.googleapis.com/maps/api/place/autocomplete/json?
types=regions:country
&input=sri
&key=API_KEY
&language=en
But I am always getting the following output.
{
"predictions": [],
"status": "INVALID_REQUEST"
}
What am I doing wrong here? It is not possible to autocomplete the country list with codes?
In your request, type=regions:country is not valid. You can use type=(regions) like the docs specify:
https://developers.google.com/maps/documentation/places/web-service/autocomplete#types
This is as close as you can get to only countries.
A request like https://maps.googleapis.com/maps/api/place/autocomplete/json?types=(regions)&input=sri&key=API_KEY&language=en will return Sri Lanka as first prediction. You could further filter your predictions by looking for only ones with "country" in the "types" field of the response.

Google Maps Find Place API locationbias causing zero results

I am trying to use the locationbias feature of the Find Place API to provide more relevant results for my searches. I have tried both a point and a rectangle, and in both cases my query returns zero results. However, if I remove the bias completely I do get a result. Why is a location that I know is within the boundary of the rectangle not being returned? Also, the field is called locationbias implying it will prefer Places near this location but not force strict boundaries, so why am I getting zero results?
Here is an example GET: https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Ariel%20Dunes%201%20Unit%20308%20Seascape%20Resort&inputtype=textquery&locationbias=rectangle%3A30.119056%2C-86.527098%7C30.444872%2C-85.705723&fields=geometry%2Flocation%2Cname%2Cplace_id
Response:
{ "candidates" : [], "status" : "ZERO_RESULTS"}
Without locationbias: https://maps.googleapis.com/maps/api/place/findplacefromtext/json?inputtype=textquery&fields=geometry%2Flocation%2Cname%2Cplace_id&input=Ariel%20Dunes%201%20Unit%20308%20Seascape%20Resort
Response:
{ "candidates" : [ { "geometry" : { "location" : { "lat" : 30.377608, "lng" : -86.366795 } }, "name" : "Ariel Dunes I (ADI) at Seascape Resort", "place_id" : "ChIJF5B7IoRbkYgRQWjAZv0-wUI" } ], "status" : "OK" }
For clarity, here's the decoded locationbias used above: rectangle:30.119056,-86.527098|30.444872,-85.705723
According to the docs this should be the southwest corner of the rectangle followed by the northeast corner of the rectangle.
The issue was due to my use of Postman. Postman implicitly encodes the query string. Disabling this feature allowed me to use a literal colon between the shape and the coordinates which corrected the behavior.

How to find gas station using Google Places API?

I'm looking to find gas stations around based on the location I provided. And it seems that the query string that I provide to the Google API is not really correct, leading to the desired result.
Here is the URL
https://maps.googleapis.com/maps/api/place/nearbysearch/json
And this is my query string:
?location=40.316828,%20-82.839840&radius=50000&type=gas_station&keyword=cruise&key=My_Google_Key
Response returned current>:
{
"html_attributions" : [],
"results" : [],
"status" : "ZERO_RESULTS"
}
The solution is simple, just remove the "keyword" parameter then everything will be ok. If this param is declared, the API will only return results with the same value as the param
Here is my original URL:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.316828,%20-82.839840&radius=50000&type=gas_station&keyword=cruise&key=My_Google_Key
Replace with this URL:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.316828,%20-82.839840&radius=50000&type=gas_station&key=My_Google_Key

Radar Search Requests are randomly failing with "status" : "UNKNOWN_ERROR"

Here is the url. Replace [KEY] with your key.
https://maps.googleapis.com/maps/api/place/radarsearch/json?sensor=true&radius=402&types=accounting|airport|amusement_park|aquarium|art_gallery|bakery|bank|bar|beauty_salon|bicycle_store|book_store|bowling_alley|bus_station|cafe|campground|car_dealer|car_rental|car_repair|car_wash|casino|cemetery|church|city_hall|clothing_store|convenience_store|courthouse|dentist|department_store|doctor|electrician|electronics_store|embassy|establishment|finance|fire_station|florist|food|funeral_home|furniture_store|gas_station|general_contractor|grocery_or_supermarket|gym|hair_care|hardware_store|health|hindu_temple|home_goods_store|hospital|insurance_agency|jewelry_store|laundry|lawyer|library|liquor_store|local_government_office|locksmith|lodging|meal_delivery|meal_takeaway|mosque|movie_rental|movie_theater|moving_company|museum|night_club|painter|park|parking|pet_store|pharmacy|physiotherapist|place_of_worship|plumber|police|post_office|real_estate_agency|restaurant|roofing_contractor|rv_park|school|shoe_store|shopping_mall|spa|stadium|storage|store|subway_station|synagogue|taxi_stand|train_station|travel_agency|university|veterinary_care|zoo&location=37.785834%2C-122.406417&key=[KEY]
When i call this url it will sometimes work but most of the time i get back
{
"html_attributions" : [],
"results" : [],
"status" : "UNKNOWN_ERROR"
}
Steps:
paste the url into Chrome (replace [key] with real key) and just reload the url request several time.
Thank you
Frank
Google itself seems to have this error:
https://developers.google.com/maps/documentation/javascript/examples/place-radar-search
Click the link and their page throws an error.

Reference Token for Google Places API added Place is not working. Accepted Places do.

I have an android application that was working great but 2 days ago things started failing. After debugging for a bit, I noticed that I was not able to retrieve details on places that I have added to Places API. After doing a places search based on my location, I do see that my added locations are listed. When I take the reference token provided and attempt to do a Places Details request, I get the following JSON back.
{
"html_attributions" : [],
"status" : "NOT_FOUND"
}
Interestingly, if I use the ORIGINAL token provided to do the same Details request, I do in fact get the details back as such..
{
"html_attributions" : [],
"result" : {
"geometry" : {
"location" : {
"lat" : 44.2778780,
"lng" : -88.39451800000002
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"id" : "c52c0ee9bdd0aea66419a0dfeaed32925f18216e",
"name" : "Amc broom closet",
"reference" : "CmRgAAAAGZwx9penijotKZ9lizruTGr8KPbrTc4CD39tPQZ5rpsoEC0ofXDr
2wpP0Ws9Vr1IIwGtTzRNyOYxOxMKQluhU-_SDydaPKJOsT9F2zqN8gBNPH-
8Lenq4tkfLKdRmhF4EhD5KdxkNndh0J_cdy4lNPI
MGhS8l2EdBcalDXfYRbkiFvWa3Bb8Og",
"types" : [ "other" ]
},
"status" : "OK"
}
If I then take that reference token and try to get Details however, I am once again left with ...
{
"html_attributions" : [],
"status" : "NOT_FOUND"
}
I am quite certain this is a new change.. Maybe I did not test thoroughly enough to begin with (quite possible). It leaves me in a huge quandry however. Because according to the documentation, my original token that works presently, might not work in the future! I'm not sure how to program around that.
Please tell me this is a temporary blip in the system, otherwise, my paddle just washed downstream.
This appears to be a bug, please post it here so we can look into this ASAP.