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.
Related
In my application, I have to use a map application to navigate to a destination. I'm using Here wego application for this purpose. I have my street address with me. From the documentation, I could see that it is possible using intents by providing a data URI with the latitude and longitude of that destination.
But I need to launch the application just by using this destination's street address not by converting it to lat long. Is there any way to achieve this?
If it doesn't exist in the documentation then it is probably not possible, also a solution like that is bound to introduce some bugs through ambiguity as there could exist multiple streets with the same name or a slight typo in the input.
I would recommend jumping through the extra hoop of implementing a google maps autocomplete or converting your address to a latitude-longitude form purely because of possible bugs even if the option existed.
You can first use the HERE geocoder API to get the geo-coordinates of your destination and then use it to construct the data URI.
See:
https://developer.here.com/documentation/android-premium/dev_guide/topics/geocoding.html
Alternatively you can use place ID from the places API:
https://developer.here.com/documentation/android-premium/dev_guide/topics/places.html
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.
I'm developing an Android app to integrate with another app.
In this app I need get the current user location and send it to the other app.
I'm getting the latiude and longitude using the following web service:
https://maps.googleapis.com/maps/api/geocode/json?address=Rua+Vergueiro,+1883,+S%C3%A3o+Paulo,+Brazil&sensor=true
The problem is that when the other app receive the latitude an longitude and convert it to address description, an wrong address is showed to the user.
The other app is using the here.com web services to convert the latitude and longitude to address description and Im using googleapi.
Anyone knows tell me what may be happening?
Thanks.
You are geocoding using one service (i.e. Google) and reverse geocoding using a second service (i.e. HERE) and the underlying data is different for each one. As it happens, the location you are looking for is at a junction as shown here
If you run a reverse geocoding search for this location, then the closest location found by HERE is around the corner at Rua Jardim Ivone - the second closest result found by HERE is the same as Google - Rua Vergueiro. As you can see from the picture this is correct - the closest house on the map to the stated location given is actually around the corner.
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 get location using PINCODE/ZIPCODE ex:560001 (Bangalore pincode).I am getting the location when I enter the ADDRESS , STATE & COUNTRY, but unable to get using pincode/zipcode. It displays UNKNOWN address.. can we find LOCATION using PINCODE ??
You can find a location (latitude, longitude) using any piece of address information but at the cost of accuracy.
Now obviously you can have a lat long corresponding individually to a
country, state, city, zip , address, etc and each will be more and more accurate, the more information you use.
Having said that, which GPS app are you using and to do what?
If the task is to find say restaurants, providing pincode should be enough.
but if you want to route from point A to point B , providing destination pincode will be hardly useful it wont pin point your exact location.
UPDATE
You can find points of interest like restaurants, banks etc, you can use google places api. You can search by just providing the pin code. refer to the following documentation:
https://developers.google.com/maps/documentation/places/#PlaceSearches