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!
Related
I am making an android application and I am thinking instead of having a database and input numerous universities and schools in our area, is it possible to use google map instead? For the user to just type the location and identify the nearest college and universities base on the location the user typed by the use of google map?
I'm not sure if there are any search features built into the Android SDK, but you can certainly still use the Place Search API.
The following example is a search request for places of type 'university' within a 500m radius of a point in Sydney, Australia:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?type=university&location=-33.8670522,151.1957362&radius=500&key=YOUR_API_KEY
You simply need to specify the type as university or school. See here for other supported types.
Use the google place api as follows
https://maps.googleapis.com/maps/api/place/nearbysearch/json?type=university&location="current lattitude","current longitude"&radius=500&key=YOUR_API_KEY
for more info visit https://developers.google.com/places/web-service/search.
I'm coding an Android application and I'm trying to get and display a list of touristic attractions from a certain city using Google Places API for Android (i.e. Central Park, Times Square...). However I've been checking the docs from here: https://developers.google.com/places/android-api/signup and I haven't found anything similar for Android.
On the other hand, the Google API for web services: https://developers.google.com/places/web-service/intro does have that functionality I'm looking for but Google says strictly not to use this API in an Android app.
I wanted to know if is possible to use this web services API in an Android app, and what other alternatives are there for such functionality I want to implement.
Try this google places API url. You will get the point of interest/Attraction/Tourists places in (For Eg:) New York City. You have to use the CITY NAME with the keyword Point Of Interest
https://maps.googleapis.com/maps/api/place/textsearch/json?query=new+york+city+point+of+interest&language=en&key=API_KEY
These result have all the details of a place like categorization (Museum, Landmark, ...) a picture, a two - three line summary about it and rating.
more details
hii everyone I am new in android and I don't have any idea about Google map api for android my question is that in my Android App I want to implement Google map which can search only hospital in a specific radius from users current location so now please tell me what kind of api I need to use to achieve this thank you
You need to use the Google Places API Web Service. It allows you to query for place information on a variety of categories, such as: establishments, prominent points of interest, geographic locations, and more.
Here is an example of a search request for places of type 'food' within a 500m radius of a point in Sydney, Australia, containing the word 'cruise' in their name:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=cruise&key=YOUR_API_KEY
Note that you'll need to replace the key in this example with your own key in order for the request to work in your application.
Check this SO question on how to return the closest 20 location to the users current location.
i'm getting latitude and longitude of a location, I want to know the roads connecting to that location and whether it is land or water
I tried one google map api which is not helping to get the information i want.
http://maps.google.com/maps/api/geocode/json?latlng=40.7127,74.0059&sensor=true
Another SO answer pointed out two possible workarounds:
You can use Google Maps Reverse Geocoding . In result set you can determine whether it is water by checking types. In waters case the type is natural_feature. See more at this link http://code.google.com/apis/maps/documentation/geocoding/#Types.
You can detect waters/lands by pixels, by using Google Static Maps. But for this purpose you need to create http service.
You can use the Google Maps Geocoding API which does exactly that: http://code.google.com/intl/da-DK/apis/maps/documentation/geocoding Take a look at the "Reverse Geocoding" section
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.