Google Places API Android find places via LatLng - android

I am trying to use the Google Places API on Android to find Universities on a map based on where you click.
So ideally I could feed the Places API a coordinate and it could tell me the Universities around this coordinate. The PlaceDetectionAPI only has .getCurrentPlace and I don't just want where the user is currently.
Any help will be greatly appreciated!
Thank you

You can use the Autocomplete API with "University" as a starting string to obtain nearby places that match that query.
Although that's not really the best solution, so you may want to get your own database of university coordinates and match them to your user's location.

Related

Google Places Android

I am trying to get a list of places of a certain type like restaurants, nearby a certain latlng. I looked into the Google Places SDK for android but I couldn't find anything for this use case. It has the autocomplete and current place search but nothing for searching a certain type of places for a reference location. The Places web API has this feature but I was wondering if it would be possible to achieve the same with the Android SDK for Places. Something like below. It's an example from the Places API
https://maps.googleapis.com/maps/api/place/findplacefromtext/output?parameters
Try to use google places Api
https://developers.google.com/places/web-service/search
Try to implement the below api with proper modification with your Your_API_KEY
Change Params: radius , type, location
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=1500&type=restaurant&keyword=cruise&key=Your_API_KEY

Tutorial for getting nearest bars using Android Places API?

I would like to use the Places API to find the geocoordinates of the nearest bars using Google Places. I'd like to store around 15 of the nearest geocoordinates in an ArrayList. Does there exist a simple demo of how to accomplish this? More generally, I would like to see a quick and dirty concrete working example of how to use the Places API to query for locations.
This link will help you. https://developers.google.com/places/#PlaceSearches you can get all nearest locations using the goole api.

How to find if a geo-location is on a road between two points?

I am a student working on an android application related to navigation trying to learn android programming. The application needs to search the geo-locations (latitude,longitude) among the ones available and find out which ones fall along the route the user is travelling.
For example, if the user is travelling from 37.422,-122.084058 to 37.422,-122.084058, then I should be able to search the points that fall along this route from the set of points that I have. How do I do that?
I am getting the route direction of the user from the google api
https://maps.googleapis.com/maps/api/directions/json?origin=Googleplex&destination=infinityloop=&key=your_api_key
I get the route in the form of legs and I have a set of geo-locations. I would like to find which geo-locations fall along the route of the user. Is there any way I can find it or any API that I can use ?
Any help is greatly appreciated. Thanks in advance :)
There's already a lib for this: use isLocationOnPath with the polyline you are getting from directions api response.
Build a LatLngBound using the two points and pass in the geolocation point you want to check into LatLngBounds.contain().

Google Maps directions text

I am making an Android app that provides directions from the current location. I want to know if there is any way to obtain the directions as text from the Google Maps. I do not need to display the map or draw a polyline. Only the directions have to be displayed as text. For example:
1. Turn left at XYZ street.
2. Go straight for 500 metres.
etc. etc.
I know that it is possible to use JSON and obtain the information required to display the directions on a map. However, this does not provide word directions. Can Google Maps API v2 be used for this? If not, how can the directions be obtained as text?
Thanks in advance!
I've finally figured out a way to do this.
The url http://maps.googleapis.com/maps/api/directions/json returns the direction information in the JSON format. One of the key-value pairs has the key "html_instructions". The value for this can be retrieved and used for the directions as text.

How to return a radius/key-word search of my data using Google Maps Android API v2

I am building a Android app using the Google Maps Android API v2.
I have a database of lat/long that Im trying to search and display, either by radius(in miles) and/or key-word based on my current location.
What would be the best way to approach this problem?
Thank you in advance.
How I would approach it:
Get the users location in lat/long
User the haversine formula to compute the distance to points already
in your database.
Filter out the points that meet your threshold criterea (less than 5
miles for example)
Within the GoogleMaps class, look at the addMarker() method. Use
this to add your filtered database lat/long to the map.
A similar approach with keywords, you filter by keyword and not haversine distance.

Categories

Resources