How to translate GPS coordinates to a place? - android

I'm building an app that uses Google places API to get current place if the internet is on. If the internet is off, I use the GPS to fetch and store the coordinates; when, later, the internet is available, I want to translate these coordinates to a place (pass to places API).
Can anybody, please, help?
I couldn't find any method in places API that takes coordinates. I tried to convert coordinates to place id and later use it in places API, but couldn't do it.

The request you do in Places API takes coordinates in the location field.
For instance:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&type=restaurant&keyword=cruise&key=YOUR_API_KEY
So if you already have the coordinates you should just make a request to the API, here you have all the info you need:
https://developers.google.com/places/web-service/search#PlaceSearchRequests

Related

Is there a way to get a list of places based on a specific location in Android Development?

I've been looking at the Places API from Google for this, but I don't know if this is the right direction to take. The project revolves around finding a list of places based on a specific location, other than the current location (for instance, what kind of restaurants are around your friend's house (based on longitude and latitude)). Most of what I've seen with the Places API involves using the user's current location. Is there a way to pass in a predetermined location? Or can I fool it into thinking that location is my current location?
I think still places is the best option for you, you have to really understand the api to get what you need from it. Look at how could you send a request to the places api with a given location (long, ltd) and it will return nearby places.
https://developers.google.com/maps/documentation/places/web-service/search-find-place#locationbias

How can I use Graph data structure to generate route with exact distance using Google API in Android?

I need help with my final CS Project. Basically, I have to write an Android app that the user can specify a starting location and distance desired. It is going to generate a route that is exactly the distance of the input that the user can walk/ run and brings the user back to the starting location, using the Graph data structure and Google API.
I have my Google map and Android app but I’m not sure where to start with storing data using Graph ( I'm not sure if I should even use this data structure) and how to calculate the distance input. Any bits of advice/ help will be appreciated!
Okay your question is very tricky but still let me answer from what I got.
Use google map api, google places api, place picker or id and google maps json api for routes and distance.
let's take an example like you want walk or run 4kms from your places and comeback.
Case 1: if you want to opt for the same route from which you went to come back.
like you went from a-b then again you are coming bak from b-a.
for this case you can use Google maps geofencing and get the place inside a minimum raidus and make an algo to get the distance from your places.
if teh distance is half of the distance from your places then pick the most approximate place.
Use google maps json to get the places distance and google place picker for the location of nearby location object.
Case2: If you donot want to come from the same route through which you went
by, then select the nearest location object and get the longest route and follow
the same algo and procedure to get the distance.

Sort location results according to the distance Google place API

I am working on an android app and want to implement checkIn feature in my android application.
I am using Google Places API for searching the nearby locations from the current location. I want the sorted results according to the locations, like If any location which is near I want that location to be shown first than other locations which are away.
I have searched a lot on this and checked the link
Place Search
I found the rankby parameter to be send in order to find the locations in ascending order by their distance from the current location.
So, we can pass the parameter with rankby=distance.
But we need to send some of the parameters from keyword, name or type. But I want to get all the results which are nearby to the current location. I cannot send any of these parameters, so how can I do it then. Please help if anyone know about it.

Marking places in android app not on the 'Google Places' database

I want to add markers on map for my android app. I do know how to do it (overlay items). My question is: Since I am manually putting markers on points(on the map) whose lat/long's I already know, I want to know if there is any way to get the exact latitude and longitude of a place on google map? Right now I am asking my people to go to the particular places and use this ( http://bit.ly/K4fOcy ) app to determine the lat/long of that place and send it to me via e-mail. I use these lat/long values to put markers on my map in the app. But the latitudes and longitudes i get are not accurate. they have around 300-2500m error (on real scale).
Or shall I use the Google Places API? How does it work? What about the places which are not in the Google Places database? How do I exactly mark them on the map? I would be very grateful if someone points me in the right direction.
Thanks
If you are working with establishments that aren't represented in the Google Places API and want to be able to pull coordinates directly from http://maps.google.com/, you simply:
Find the location of interest on the map, using an address or just knowledge of the area
Right-click on the map and select What's here? from the context pop-up menu
The Lat-Lng coordinates will be automatically populated in the search input box and usually, the address will also be displayed in the dynamic side-panel (and very often a Street-View photo).
If you are looking for a way to query for the coordinates, you can use the Geocoderdev-guide service to turn addresses into coordinates.
Have you looked at the geocoding API for google maps? It allows you to pass in an address, and returns a Latitude/Longitude pair in response, there is an accuracy value returned with each response to let you know how close the geocoder was able to resolve the location. https://developers.google.com/maps/documentation/geocoding/

Want near by location information within 1KM range

I am working on a application which gives me all near by places within 1km range from my current location. I am able to get longitude and latitute of the current location using LocationManager class in android. Using this information i want to get information (i.e. long/lati) of the nearby places. I have seen some of the webservices alos but couldn't get the answer. Please help me.
There is a Places API Application Form that you'll need to fill in in order to get access to the Google Places API. This application will be verified by Google and they'll provide you with the necessary access.
You'll also need a Google Adsense Publisher ID (
More info on the Places API can be found here :
http://code.google.com/apis/maps/documentation/places/

Categories

Resources