I am trying to use MapView and I want to show in the map some points of interest (like restaurants or stores) near my location. Is there a way in the api to get this kind of list? I know I can do this manually, but first I would need to get the geolocations. So which would be the best way to do this?
checking current location is possible. but we can get the center point of set of lat & lang. get nearest lat&lang from current location is the solution for now.
Related
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
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/
My application requires that a user select a location on a MapView. I will be using Google Places API to place location markers on the map. There will be times however when a user might select a location, for example a fountain in a park, that IS NOT listed in the Places API. One option is to offer users a choice of selecting a location with a touch on a map, OR selecting map markers of known locations using two different maps for each activity. I think the perfect solution however would be to use one MapView that contains the mapmarkers but also allow the user to select a location that does not have an associated marker.
My thoughts were to apply a reticle in it's own Overlay that stays centered in the middle of the MapView despite scrolling and a select button to make the selection.
If the reticle is over a marker, for example, Sams Cafe', then the button would read "Select Sam's Cafe'", if the reticle isn't over any Map Markers, then the button would read "Select this location".
I am having trouble figuring out a way to verify the reticle is over a marker. Since the marker is limited to a single GeoPoint, it's going to be very difficult, frustrating and time consuming for the user to try and match the reticle center to the exact GeoPoint.
What would be optimal is a check to see if the reticle is over the Map Marker graphic. I presume this will utilize projections and bounds??
Two questions, How to do this if possible?
or, is there a better UI that I am overlooking that is much easier to achieve?
Thank you for your consideration.
If you use the way you saying is better than anyone, but why dont you keep away any user from any kind of geocoding. Like user selects the location through marker, on the basis of that user will confirm the location, if it has got any place then it will show the address or it will show the nearby location. e.g. let the user select the location from marker get the longs. and lats. , If user confirms that location then put it onto geocoding and get the location address, it will surely return an address maybe exact or nearby and if user likes it, user will confirm it, simple. Please notify if its not feasible way.
I am currently developing an app for getting nearest banks and atms from the current location of user. I am successfully getting all the details from Google Places API but now i wish to sort them according to nearest to the user. Right now it is giving me random means the first results which i am getting is not nearest to user. I want that the first data and others are sorted on the basis of distance from users current location.
If anyone has idea then please kindly help me.
Thanks!!!
There is an additional option rankby=distance which you can add as a parameter in the URL.
Please go through the Google Places API documentation for further details. I think it will be of use.
First try to current latitude and longitude of the end user and bank or ATMs.
Then, calculate the distance between (the current location and all the banks and ATMs) both of them with the method distanceTo().
Store the distance in the hashmap or arraylist as convenient to you.
Then, sort this distance. Whichever distance is less, retrieve it. It will be the nearest place.
Use this.
float dist = user_location.distanceTo(bank_or_atm_location);
doing "points of interest along a route" in google maps
This would fit perfectly to my question...... But its not suitable for an android activity :/
So I start copiing the question now... just wait :D... aargh! Done!
I need to allow travelers to use google maps to plot a route, and then
query my database of points of interest (let's say, McDonald's
locations) and then show all of these locations that are within a mile
or two of the route they will be taking. The question is, how do I
efficiently take the "driving directions" information that comes back
from google (essentially an array of lat/long pairs), and turn that
into an sql query to get locations that fall within a certain distance
from the route?
...and then put the whole thing into my android app?
I dont get it :(
First things first:
1) do you have latlng (geolocations) variable type in your database?
If answer(1) == yes:
Calculate and query your database: D²=(Xb-Xa)²+(Yb-Ya)² along each of your Xa,Ya route points to discover the POIs (Ya,Yb) within Distance = D.