Place present on Google Maps, but not showing in Places API call - android

I am using Google Places API in my Android app to detect bike shops in the user's proximity. I have a problem with this shop (Joy Ride Bicycles): https://www.google.ro/maps/place/Joy+Ride/#47.03567,-122.818342,17z/data=!3m1!4b1!4m2!3m1!1s0x54910b4572c99c39:0x340b219b8ac15ba1
Although it's present on Google Maps, it isn't returned when I make a call to the Google Nearby Places API. I have tried with different ranges locations. I've had similar issues with other shops.
Has anyone else encountered this problem?

There can be multiple reason according to Google Documentation
Why are some Places not returned when I filter by type?
It's possible that the place you are looking for has not yet been
categorized. All places are categorized as the generic type
"establishment" until Google has enough data about a place to
categorize it as one of the supported place types.
As a workaround you can pass the place type to the keyword parameter.
The keyword parameter is matched to: name, type, address, and customer
reviews.
If you would like to add the category type to a place listing
yourself, submit a place edit. Once the edit has been approved and
published it will appear using the correct type filtering.
Why are some nearby places not returned?
By default, the Places API sorts results by prominence within the
supplied radius. A Nearby Search request can return up to 60 results,
split across three pages. If a Place ranks 22nd in prominence, it will
appear on the second page of results which you can access through
paging. If a Place ranks greater than 60th in prominence it will not
be included in the search result, even if it is closer to the center
of your search.
You can sort your results by distance instead of prominence by setting
the rankby parameter in your query to distance and omitting the radius
parameter. Relevance will be ignored and places will be returned in
order of distance from location.
If you are filtering your request by type, some results may be
filtered out of the response.

Related

Google Places consuming from REST not filtering by desired type

I'm consuming a result from the REST API of Google Places, so far this is what Google Maps tell me about the nearest places around me
Now, I'm using this URL to query my results
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=lat,long&radius=50&type=restaurantkeyword=restaurant&key=MY_API_KEY
According to this, I'm using the correct type = to filter my query.
I'm filtering by type restaurant with a radios of 50 meters; now, the result that the rest provides to me is this:
Where you can see that the results showing here are not for the type restaurant, but instead it searches for all establishments as the FAQ says
Why are some places not returned when I filter by type? It's possible
that the place you are looking for has not yet been categorized. All
places are categorized as the generic type "establishment" until
Google has enough data about a place to categorize it as one of the
supported place types.
As a workaround you can pass the place type to the keyword parameter.
The keyword parameter is matched to: name, type, address, and customer
reviews.
If you would like to add the category type to a place listing
yourself, submit a place edit. Once the edit has been approved and
published it will appear using the correct type filtering.
But the problem is that indeed in Google Maps it appears to be restaurants near me, but the query just return all the establishments around me.
Is there a way to fix that response in order to just return the restaurants near me and not all the places?
Your url query has bug. You need to insert an '&' between restaurant and keyword. I tested with the below query and it looks correct:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-31.41668,-64.1909&radius=50&type=restaurant&keyword=restaurant&key=MY_API_KEY

Download Specific data from Google maps?

I am building an Android app which can check in(Something quite like foursquare) to specific places (In this case restaurants),I am just wandering is there a way for me to get data in google maps?(location and name of the place) to my app's database?Adding places manually seems quite impractical as there are lot of places to be added into the database.If it can't what would be the best practical solution?
Actually there is, you can use Google Places API - Nearby Search Requests. From the docs:
Nearby Search Requests
A Nearby Search lets you search for places within a specified area.
You can see an example just below the optional parameters.
The following example is a search request for places of type 'restaurant' within a 500m radius of a point in Sydney, Australia, containing the word 'cruise' in their name:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&type=restaurant&name=cruise&key=YOUR_API_KEY
then to retrieve further details using a Place Details Request, as described in the reference Search Results parameter:
reference contains a unique token that you can use to retrieve additional information about this place in a Place Details request. Although this token uniquely identifies the place, the converse is not true. A place may have many valid reference tokens. It's not guaranteed that the same token will be returned for any given place across different searches.
Note: The reference is now deprecated in favor of place_id.
Hope this helps you in some way. Good luck. :)

Google Maps API nearbysearch not returning the nearest locations

I am working on an android app and want the checkin feature in my application. I want to get all the locations nearby my current location.
I have used the Google Places API and sending a request on the below url for getting the results.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=28.4573585,77.0332349&radius=2000&key=AIzaSyByyUldmVJqsrB_yYGlVzWF92des4DbsZ0
I want all the results inside 2 Km distance from my current location.
I am getting some nearby locations but not getting the nearest locations which are 100 meters or 200 meters away from the current location.
How can I get them, do I need to pass some extra parameter in the above nearbysearch request.
Also, I need to order the places according to the distance. nearest places should come first in the results.
Please help me if anyone know how to achieve this.
Thanks a lot in advanced.
By default, each nearby search returns up to 20 locations per query. However, accessing additional results as many as 60 locations, can be done by passing the value of the next_page_token to the pagetoken parameter of a new search as shown in Accessing Additional Results.
Additionally, Nearby Search Requests can be refined by supplying keywords. You can put ordering on the results according to the distance by specifying rankby=distance in your search request and adding one or more of keyword, name, or type as required.

Google places API- place type. How can I customize this?

I got this 1 line code from developers.google.com.
Can anyone explain to me what does the code means. and can I replace museum with hospitals under the types part, since im developing an app that navigates to hospitals
" https://maps.googleapis.com/maps/api/place/radarsearch/json?
location=51.503186,-0.126446&radius=5000&types=museum&key=AddYourOwnKeyHere"
Check this. list of supported place types
https://developers.google.com/places/documentation/supported_types
types — Restricts the results to places matching at least one of the specified types. Types should be separated with a pipe symbol (type1|type2|etc)
Check this https://developers.google.com/places/documentation/search
This Code Needs API_KEY to be access this line...
it Contains Following Parts
location=51.503186,-0.126446 - Latitude and Longitude, means a place from where it starts searching
radius=5000 - "radius" localizes results to a certain radius.
types=museum - Restricts the results to places matching at least one of the specified types (You can change it to "hospital")
key=AddYourOwnKeyHere - Your application's API key. This key identifies your application for purposes of quota management and so that places added from your application are made immediately available to your app
Follow This Document For More Info... Place Search

Find the type of a location in Android

Given that I have a set of location coordinates. How can I find the 'type' of that place.
Eg. Can I say that the place is a restaurant or cafe or shopping.
It would be the way Places API can tell you the type of each nearby place. Except that n my case, i want the type of the place in question.
Thanks!
You should be able to do this with the places API. Get the coordinates from the device, and make a request to the Places API with the latitude/longitude, and a very small distance (say, a matter of feet). You should probably also rank by distance, as prominence is default. Then, use the first result, as it will be your closest match, and extract the type.
https://developers.google.com/places/documentation/search#PlaceSearchRequests

Categories

Resources