Android Google Map - how to display all address of matching location? - android

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.

Related

Google Maps: open URL by coordinates but show the location name

I've been trying to open Google Maps (specifically on Android, but not necessarily) from a coordinates URL, such as
https://www.google.com/maps/search/?api=1&query=51.5055,-0.0754
But when the map opens, I want it to show the location name such as "Tower Bridge". Not the coordinates 51.5055,-0.0754
I have tried something like
https://www.google.com/maps/search/?api=1&query=51.5055,-0.0754&query_place_id=Tower+Bridge
with no luck. When maps opens it shows the coordinates, not the place name.
I am okay with either "injecting" the location name (something like https://....&location_name=Traitors+Gate), and/or with maps revealing the location name (reverse geocoding) from the coordinates.
Motivation: Coordinates are more accurate and less ambiguous than location names. For example, there is Jerusalem, OH and there is Jerusalem, Israel, which is half a world away. Or, "Palais de Louvre" which is just one building but one huge building over four streets, with multiple entrances. Coordinates solve those issues, but they are not "Human readable". You can't present "49.3697,0.8711" to a user and expect them to recognise the Omaha Beach.
Thanks
Unfortunately, the Google Maps URLs doesn't support this kind of sending labels. You should send a valid place ID value in order to get correct title of the place in Google Maps app.
You will need one additional step to do this. Execute reverse geocoding request for coordinate and get a place ID.
https://maps.googleapis.com/maps/api/geocode/json?latlng=51.5055%2C-0.0754&language=en&key=YOUR_API_KEY
This will return a place ID ChIJlRsEuUgDdkgRSM7ciIhVooM of Tower Bridge. Have a look at this example in Geocoder tool:
https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D51.5055%252C-0.0754
There is a Java client library for Google Maps API Web Services that you can find on GitHub:
https://github.com/googlemaps/google-maps-services-java
You can use this library to execute geocoding requests, alternatively you can also use Places API nearby search to get the nearest place. Note that web services require a different API key, because they don't support Android app restriction that you use in API key for Maps Android API.
Once you get a place ID value just create Google Maps URLs link. E.g.
https://www.google.com/maps/search/?api=1&query=51.5055,-0.0754&query_place_id=ChIJlRsEuUgDdkgRSM7ciIhVooM
I hope this helps!

Google maps api geocode returns zero results for valid address

http://maps.google.com/maps/api/geocode/json?sensor=false&address=
I was looking at the above api and trying to find the location of the address "Grand Copthorne Hotel"..
However the result I am getting in the api is as follows
"status" : "ZERO_RESULTS"
Please let me know why this is taking place as it is affecting my entire platform and if its a problem from your end when should I expect the issue to be solved
Please let me know about the above issue
Geocoding API filters out businesses, it works only with street addresses.
If you need the location of the business you have to use Places API search.
E.g.
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Grand%20Copthorne%20Hotel&key=YOUR_API_KEY
Please refer to the documentation for further details:
https://developers.google.com/places/web-service/search
The Google Geocode API filters out businesses and only works on addresses. You said you have a valid address, but "Grand Copthorne Hotel" is not a valid address. An address provides enough information to mail something to a specific person or business.
If you want to retrieve location information with a generic search term, you should use a different API.
You can try some searches in the Google Places API search box; maybe that is a good API for your situation. It returns lots of information, including latitude and longitude. Check out the documentation.
The first thing you should do is discover and decide what kind of API you actually need. Do you need information for product shipping? Do you need to show a map to a user? Do you need to retrieve businesses' information?
Keep in mind that there are many kinds of location searches and varying services that return latitude and longitude. For instance, there is geocoding (generally matches addresses or partial addresses to a fairly accurate latitude and longitude pair); there is address validation (matches addresses to a database of information—probably postal service information—to provide very accurate location information for real addresses); there is places search (search for names, icons, titles, or business terms and retrieve location information). There are still other options. Just take a look at one list of mapping-related APIs from Google...
Full disclosure: I work for SmartyStreets, an address validation service.

Android - Maps API - Check the current address location type

I was wondering as to whether it is possible to get the current location type based on the address. The implementation is that using GPS I will be able to get the address of the current location (similar to dropping pins on Maps and getting the address).
What I would like to know is whether based on the address, can I get the type of the location for example whether it is a movie theater, hospital, a restaurant, shopping mall, etc.
Has anyone tried to implement this?
Yes. You can use the Geocoding API to get the place_id. This is a unique identifer that can be used with other Google APIs, like the Places API. This gives more information (name, ratings, etc).

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/

Specify the country to be searched in Android GeoCoder?

I can specify a square where the Geocoder shall search in, but I found no way to specify a certain country. Unfortunately, my country isn't quadrangular ;( What should I do? Use another reverse geocoding service?
I'd want to build a search box where the user can search for a city (with auto suggestion). On every keystroke the current search query is going to be delivered to the Geocoder.
If it's any help, the official Geocoding API can do regional biasing. It would require you to use their web API instead of the Android API.

Categories

Resources