In my app, there is a search box, user can enter any specific location, and i have to show that exact location on map. I searched a lot but not getting the exact answer. Please give your suggestions.
Google cannot give you location values for some vague locations. May be you can fetch all the locations from "https://maps.googleapis.com/maps/api/place/autocomplete/json" API. use the predictions and set to autocomplete textview.Once they select any location you can reverse geocode the location and get latitude and longitude values from that and set it to map.
Related
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.
I have this code to start a navigation activity
String uri = "geo:0,0?q=<lat>,<long>";
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
Google Maps starts and show the correct location on the map but at the bottom panel, instead of the location name to find a route to, I see the latitude and longitude I've sent.
The lat/long data makes it certain about the location I want but shows this info while sending it the location name might show it as I expect but it might get confused with several similar locations. How can I solve this?
You can show a name in the marker in google maps using the following URI:
String uri = "geo:0,0?q=34.99,-106.61(Treasure)";
As explained in android documentation
Not quite sure I fully understand what you're asking for, but it sounds like you want Reverse Geocoding. You can convert your Lat/Lng to a location with it. It generally gives a very detailed response, usually including the street address number, so that's one way to distinguish similar locations.
I want to get only the latitude and longitude of my current location using google maps. But I dont want to display the map. Is it possible to do so? And how can I use only Internet without Gps to get my current location?
You need to get the location using a LocationManager, Google Maps actually utilizes similar functionality to get the location before drawing it (and the map) for you. You may certainly only use your network provider for GPS locations, you should look into differences between FINE and COARSE locations (and their permissions). I would start posting links, but there are tons. Just start googling for LocationManager and Network GPS on Android. Just for fun though, here is the first link I found (seems to be pretty solid).
http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/
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/
I am trying to displaying a user current location on a map using phoneGaps getCurrentPosition function but I don't just want the users latitude and longitude I want their actual location example state they are current in, street name, country name ect. If anyone could point me in the correct direction I would greatly appropriate it (ebooks, weblinkes, blog post, code snippets anything). Thanks
You're going to need to reverse geocode the lat/lng into an address. Google has an API for that: https://developers.google.com/maps/documentation/geocoding/#ReverseGeocoding