Getting nearby places based on the User's current location - google-places-api

Can any one please suggest me to use any standard API to get the nearby hotel list based on the User GPS location.
Thanks in advance

Using the Google Places API you could perform a Places Search Request where location is the users lat,lng and types=lodging to search for hotels:
https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&types=lodging&sensor=false&key=YOUR_API_KEY
You will need to follow the instructions here to obtain an API Key to use the service.

Related

GeoDjango and mobile app. Finding an address and geoposition

I'm a newbie.
There is a mobile application and a backend for Django Rest Framework
The user should be able to select their home on the map or find it using the search bar.
The database must contain the full address (street, house and apartment separately from the rest of the address) and geolocation (probably longitude and latitude, because later it will be necessary to search for users' homes within a certain radius from the user's current location).
Questions:
Which of these should be implemented on the server? What is needed for this? Examples are desirable
What should the model look like to save the address and geolocation in the database?
I would be grateful if the answers also contain links to the documentation I need.
I made tutorial on basic usage of geodjango. Try this
https://hvitis.dev/geolocation-tutorial-geodjango-demo-and-gis-postgis-data-to-build-app-using-rest-api/#calculate-points-distance

How to get place description using Google API or any other API?

I am using Google API to get the place information and store it into database. Using Google API I am able to get address, opening hours, rating and reviews as shown in below image.
But, I am not able to get place description which is highlighted in below image in red circle. ("Quaint Italian mainstay for deep-dish, Chicago-style pizza, calzones, pastas & hot dogs.")
I want that information in my application. I think google is taking those information from
Freebase https://developers.google.com/freebase/guide/basic_concepts
Wikipedia https://www.mediawiki.org/wiki/How_to_contribute
But I am not sure.
Can any one help me suggest me that how I can get that information or any other API that I can use to get that information based on google place_id.
Any help would be highly appreciated.
Thank you
Accordingly to the documentation and #xomena, currently you cannot obtain this data via Places API. There is a feature request in Google issue tracker to make the detailed business type available in Places API, however Google doesn't expose any ETA (estimation time of arrival:
https://issuetracker.google.com/issues/35822953
Feel free to star this feature request to express your interest and subscribe to notification from Google.
To my knowledge it is not possible to get this information from the Google Places API. The API documentation does not display the venue description. Try to have a look here: https://developers.google.com/places/web-service/details (it might be that Google does not share all information from their platform with other developers..).
I would suggest you to do one of the following (or perhaps both):
Scrape Google the old school way; i.e. by getting the information from the HTML. There is a quite decent guide for doing that here (you would of course have to adjust the example to scraping Google instead): https://medium.freecodecamp.org/how-to-scrape-websites-with-python-and-beautifulsoup-5946935d93fe.
What I would recommend and which probably is the fastest: enrich your current data with other data. You could e.g. use Foursquare and search for the places you get from Google. It should be possible to get the description for each place on Foursquare. See here: https://developer.foursquare.com/docs/api/venues/details. If you have problems with matching the places after your query has returned, because the venue names are not exactly the same - but close, then you could use an algorithm to match strings that are close; perhaps using the levenstein distance (https://en.wikipedia.org/wiki/Levenshtein_distance).

get autosuggestions via Bing Search API v2

How might one be able to get the list of autosuggestions for a given search from Bing Search API like in the screen capture below? This doesn't seem to be among the results provided by choices of [Web|Image|Video|News|SpellingSuggestion|RelatedSearch]. Alternatively, does Google provide this?
As background, Bing can be queried via REST API using a query string, such as this URL (note it requires a developer key for basic auth). One can change the 'Web' keyword to get other results, but I'd really like to get the suggestions specifically:
https://api.datamarket.azure.com/Bing/Search/Web?Query=%27sushi%27&$format=JSON&$top=5
Bing Developer docs
There is an api route directly to the Bing suggestion list. Interestingly, this is separate from the developer API list. Currently the link is
api.bing.com/osjson.aspx?query=[URI encoded search term here]

search my locations with Google places api

I have added 100 locations to google places using google place api.Now i want to know the number of locations that i have added to google places.
So my question is that Is google provides the api that will show only the number of locations that i have added with my api key ?
This is currently not possible without keeping your own tally of added places. If you think that this would be a useful feature please add a Places API - Feature Request.

Google Places API Email/Website

Is there a way to get Email/Website of a particular place using Google Places API? If this is not possible is there a way other than using Google API?
To retrieve a places website address using Google Places API, you could perform a Places Autocomplete Request with the input parameter value set to the name of the place: e.g.input=Amoeba
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Amoeba&sensor=false&key=your_api_key
Then using the reference from the response you could perform a Places Details Request: e.g.
reference=ClRMAAAAVzPUTLym999EXs4mKkpTqEmzX0a2kfXCUs4enTvWMHDd06VLvlzsGOdfrRd2QvkiRWs4sNkraAAJlMdytt4O4kYGoJZn4ENL5Ig5QYyeJmMSECDOGMO1MnDFtqzdqD8oDk0aFJr8_s-Y946QOz24YubPUsmoC2vl
https://maps.googleapis.com/maps/api/place/details/json?reference=ClRMAAAAVzPUTLym999EXs4mKkpTqEmzX0a2kfXCUs4enTvWMHDd06VLvlzsGOdfrRd2QvkiRWs4sNkraAAJlMdytt4O4kYGoJZn4ENL5Ig5QYyeJmMSECDOGMO1MnDFtqzdqD8oDk0aFJr8_s-Y946QOz24YubPUsmoC2vl&sensor=false&key=you_api_key
This would return the details for Amoeba including if available, the parameter website which would contain the places website address.
Google Places API provides Details requests and responses using your API key.
The tag allows for the google places url for that places
e.g.
http://maps.google.com/maps/place?cid=10704550479004381649
If you wish to harvest website, fax and opening hours information, it can only be done here.
There is no direct api in the Google Places API that will provide that info.
Just as addressComponents are part of the Details response, i assume tags will be added to the Place Details responses from the API to address this problem.
I have been trying to use Google Places API, and I have successful queries, fetching Places details, which has all the address information for the place I want to find, but ironically, there is NO WEBSITE attribute in the returned JSON!
The first version of Local search was MUCH better, and always accurate for searches when you know the business name.

Resources