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
Related
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 am trying to build a location based application which shows google map and allows the user to search a location by writing an address (as google maps does).
I have been trying to use android's geocoder to do this, and it finds some addresses. However, one of the first addresses that i tried (vaasankatu, helsinki, finland), it didn't find when I searched by street name (vaasankatu). Also one other street name that I have tried does not return any results. If I add the city (helsinki), or the country (finland) after the street name, then geocoder finds addresses.
Google maps web app and android app find the addresses without any problem just by searching by the street name. I am wondering whether I could somehow make geocoder to return the address when it is searched by the street name? I could of course try to find out the current city with the geocoder and attach it after the query, but this seems a bit like a hack, is there a better way?
I am also a bit worried about the geocoder documentation, which says:
"The Geocoder class requires a backend service that is not included in
the core android framework. The Geocoder query methods will return an
empty list if there no backend service in the platform. Use the
isPresent() method to determine whether a Geocoder implementation
exists."
I don't quite understand what that means.. So is there a big portion of phones that don't support geocoder? The text seems to suggest there might be, but why would there be such an api then at all..? Should I use another api alltogether? Is, for example Google geocoding api for web services usually used? Or places api?
I have a form in which user will type his address but i want to create such widget for address so that whenever user types his address, then all similiar location will be listed in the suggestion box and user can select his location.
Similiar functionality i have seen in google map navigation application.
Can you please tell me how create such feature?
If you are talking about matching places for a street address, this should work:
use reverse geocoding to convert it into (latitude, longitude) pair, both Android itself and Google API provides this service;
use Google Places API to obtain nearby places using the pair of coordinates
I have a project which actually does the similar job, while due to some reasons it is not public, but I can assure you this way could work.
Hope it helps.
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/
Geocoder getFromLocationName is not returning anything if I'm searching for business places. Here are my finding so far:
grocery places, commercial buildings -> no result
schools -> finding results, but only returning Latitude and Longitude. I have to do reverse geocoding in order to get the address based on the coordinates, but the address wouldn't be accurate.
complete address -> same as school, only returning Latitude and Longitude
hospital and pharmacy -> returning Latitude and Longitude
I've tested this on 1.6, 2.1 and 2.2 devices that has Google Maps.
I'm trying to find if there's a limitation explained somewhere on the SDK, but there is none except:
The amount of detail in a reverse
geocoded location description may
vary, for example one might contain
the full street address of the closest
building, while another might contain
only a city name and postal code. The
Geocoder class requires a backend
service that is not included in the
core android framework. The Geocoder
query methods will return an empty
list if there no backend service in
the platform
(http://developer.android.com/reference/android/location/Geocoder.html)
[update]
So after nights of research, I can't seems to make it work - Google simply wont give me the result. Some discussion on android-developers points a fact that getFromBusinessName was omitted when Google Navigation came out. So I'm starting to assume that Google is pulling back some of their geocoding service.
I can always create a webpage that use Google Geocoder API, but its limited to 2500 api call - and I dont think it will be legal (lol). So what are my alternatives here?
I've hit the same problem. I'm finding that the geocoding API often returns no results if I include the business/venue name, but by missing it off, the lat/long can be much less accurate.
I've implemented a pragmatic solution:
1. Call the API with a string including the business/venue name
2. If it fails, call it a second time without the business/venue name, just the address
I've yet to see a case where no location is returned, so it seems a decent compromise as it means I do at least get location data, if sometimes less accurate, and the cost of a second API call is mitigated with threaded calls.
I couldn't find the button to reply but, like you all, I have just run into the same problem. I haven't tried it yet but it sounds pretty solid. A potential workaround is located here:
Using Google Maps API to get Address of Business
Happy coding :)
Edit: Forget that link and check this one out: http://code.google.com/apis/maps/documentation/places/
Try this approach:
1) Use Geocoder to convert latitude-longitude to address
2) Make an API call to Whitepages (or similar service), specifically the reverse_address method which will get you business name for the address mentioned.