We are using the nearby search feature as described here (https://developers.google.com/places/web-service/search) to perform auto check-in in Android as well as iOS mobile apps.
However, when we call the web API, many of the nearby locations do not show up in our results. At the same time, I do receive notifications from the Google Maps App on my Android phone, asking if i am at the venue meaning the google maps app correctly detects my location.
As an example I was dining at Nando's located at:
https://www.google.com/maps/place/Nando's+PERi-PERi/#41.8854864,-87.6238967,19.85z/data=!4m5!3m4!1s0x0:0x714d54c7334f4af6!8m2!3d41.885548!4d-87.624252
But when I called the nearby search, Nando's did not show up in my list of nearby places. I checked and my gps coordinates were correct and google maps was able to detect my location and check me in.
Anybody know why this happens? Is there a workaround or a solution for this problem?
You didn't post the Places API query, so it is difficult to say what is wrong in your application.
I tried it myself and it worked for me as expected. Let suppose I have a GPS coordinate 41.885565,-87.62425, this is a position more or less of the Nando's you mentioned in the description (have a look at Geocoder tool):
https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D41.885565%252C-87.62425
Now I can create a nearby search request for location 41.885565,-87.62425 with results rank by distance, so the nearest place will be the first in response and also we have to apply a type parameter in the request according to the documentation:
If rankby=distance (described under Optional parameters below) is specified, then one or more of keyword, name, or type is required.
The resulting request is
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=41.885565%2C-87.62425&rankby=distance&type=restaurant&key=MY_API_KEY
With this request I get Nando's (place ID ChIJ9xIeWq8sDogR9kpPM8dUTXE) as the first item in the response
"results":[
{
"geometry":{
"location":{
"lat":41.8855475,"lng":-87.6242518
},
"viewport":{
"northeast":{
"lat":41.8870082302915,"lng":-87.62290226970849
},
"southwest":{
"lat":41.8843102697085,"lng":-87.6256002302915
}
}
},
"icon":"https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"id":"a29ff7d92a100fd6f5a8c0e34dff84806838f2d9",
"name":"Nando's PERi-PERi",
"opening_hours":{
"open_now":false,
"weekday_text":[
]
},
"photos":[
{
"height":3036,
"html_attributions":[
"Marco Laure"
],
"photo_reference":"CmRaAAAAwbEPFsgrrjKVrplwBAAmKhKe5CkFX9wn_x1ZF9d6K8rRdT8tRUiW23-qEGLwbuf1wePdUkSrSN21a8r696kXGv6KYG42mI7RaDf2n80iLJlDVtEXys1KK4Hn9_nebsLwEhC6CQemKH3oHLe52i5m-JzOGhQoYbUFTntC5IuEzvASfjPvhDgr_g",
"width":4048
}
],
"place_id":"ChIJ9xIeWq8sDogR9kpPM8dUTXE",
"price_level":1,
"rating":4.2,
"reference":"CmRRAAAARrKCjwMLRvvXncBVw9pCf8RNq1GpfjDrHD8Jh_du12zBJxJ_eaGidizxAny31qn24BgZDpab346A3_QYbgaUMMZOnratR9XBNkQNS1a-DCPSFggzNjsUoOl_QQkhQU-DEhDExmV2z_pyXAkAoxRzIAVQGhT5kjoH3myVM7-vraAlw0EG512ykw",
"scope":"GOOGLE",
"types":[
"restaurant","food","point_of_interest","establishment"
],
"vicinity":"117 East Lake Street, Chicago"
},
I hope this helps!
Related
Is their any way to get nearby streetviews coordinates with respect to a particular location (coordinates)
Here, I am using this thing, but it is returning wrong information
.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=13.0602543,77.6471364&radius=1000&type=streetview&sensor=true&key={API_KEY}
I would suggest using the Street View Image Metadata endpoint in order to get nearest available street view panorama.
In your case you can run the following request
https://maps.googleapis.com/maps/api/streetview/metadata?location=13.0602543%2C77.6471364&radius=1000&source=default&key=YOUR_API_KEY
This request returns the following response
{
"copyright":"© Prashant Dubey",
"date":"2018-09",
"location":{
"lat":13.0602702,
"lng":77.6470768
},
"pano_id":
"CAoSK0FGMVFpcFBLMTdMM25RWEMxWEk4TmJWZkdmbzZpdlZJdWZ0aHhmbFlyR2s.",
"status":"OK"
}
So you have here both the location and pano ID.
I hope this helps!
I have an android app that gets the lat&long from the device and uses googles reverse geocoding api to give back an address. Everything was working fine for some time but now all of a sudden I get zero_results/
I replicate it in my browser the request is:
https://maps.googleapis.com/maps/api/geocode/json?latlng=31.783783783783782,35.22879215957073&key=MY_KEY
but if I change it to:
https://maps.googleapis.com/maps/api/geocode/json?latlng=31.78,35.22&key=MY_KEY
which is just shortening the lat&lng to 2 decimals it works, but say if I round it to 2 decimals:
https://maps.googleapis.com/maps/api/geocode/json?latlng=31.78,35.23&key=MY_KEY
It doesnt work!!!
I cant rim it without rounding it, but now i am afraid in another case it wont work, I don't know what is going on with the API, everything was working fine before.
Any help solving this would be appreciated.
Thanks
This is because Google gives no support for disputed areas (such as Kinmen County, West Bank, Crimea, etc.). ZERO_RESULTS is the intended behaviour.
You can see the problem in google public issue tracker at https://issuetracker.google.com/issues/35826813
The bad news, your point is at the DMZ. As stated above: Google Reverse Geocoding won't work near the 1949 armistice lines (and not in what used to be Jordanian territories 1949-1967).
The not-so-bad news: There may be some kind of a workaround that's feasible for some: OpenStreetMap can also provide reverse geolocation. Your coordinate:
https://nominatim.openstreetmap.org/reverse?&format=jsonv2&lat=31.779975&lon=35.227901
Yields
{
"place_id": 199263301,
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright",
"osm_type": "relation",
"osm_id": 7880713,
"lat": "31.7782568",
"lon": "35.2315827592487",
"place_rank": 30,
"category": "historic",
"type": "heritage",
"importance": 0,
"addresstype": "historic",
"name": "Old City of Jerusalem and its Walls",
"display_name": "Old City of Jerusalem and its Walls, HaOmer, Jewish Quarter, Old City, Jerusalem, Jerusalem District, no, Israel",
"address": {
"address29": "Old City of Jerusalem and its Walls",
"footway": "HaOmer",
"suburb": "Old City",
"city": "Jerusalem",
"state": "Jerusalem District",
"postcode": "no",
"country": "Israel",
"country_code": "il"
},
"boundingbox": [
"31.7728081",
"31.7837416",
"35.2257013",
"35.2375582"
]
}
As you can see, they may be off by quite a few hundreds of meters. In this case (I was mean, choosing a case that augments the issue) it spells 15min diversion by foot, and no way by car.
Some may find it tolerable. For others it means sending someone to the wrong place.
On the other hand, as mentioned before, I did pick a nasty case. In most cases OSM are pretty much accurate to a few meters.
I just want to add that on 1/29/2018 I also started experiencing random results from the API. My code has been working great for more for a year. Now I can send a request with a well-defined location (not reverse; I start with an address or intersection in search of coordinates and geopolitical info) and I get no results. I can send again- no results. And I can send again- and I GET RESULTS! Same exact query, with differing responses. I think the root cause for my
Is it possible to get a response (true or false) if are a traffic jam from your position to your destination, using google maps android API? Or using google maps web api?
Can not find anythink about that.
I believe there is no direct Google endpoint that can answer this question. However, you can implement a workaround using a Distance Matrix API web service or Directions API web service. If you specify a departure time in the request, the response will contain fields duration and duration_in_traffic. So you can figure out if duration_in_traffic is much bigger than duration and decide if there is a traffic jam somewhere on this route.
For example,
I execute Distance Matrix API request for two points in Barcelona
https://maps.googleapis.com/maps/api/distancematrix/json?origins=av%20Diagonal%20198%2C%20Barcelona&destinations=plaza%20Espa%C3%B1a%2C%20Barcelona&departure_time=now&key=MY_API_KEY
The response is
{
"destination_addresses":[
"Av. del Paraŀlel, s/n, 08015 Barcelona, Spain"
],
"origin_addresses":[
"Avinguda Diagonal, 198, 08018 Barcelona, Spain"
],
"rows":[
{
"elements":[
{
"distance":{
"text":"6.0 km",
"value":6049
},
"duration":{
"text":"17 mins",
"value":1035
},
"duration_in_traffic":{
"text":"19 mins",
"value":1134
},
"status":"OK"
}
]
}
],
"status":"OK"
}
Comparing duration_in_traffic and duration from my response I can say that currently there are no traffic jams on this route.
I hope this helps!
I've been trying to integrate a Google schema (LodgingReservation schema) in my company's hotel booking confirmation e-mails, in order to make corresponding hotel reservation cards appear in Google Now/Google Search, as specified in the following Google documentation :
https://developers.google.com/gmail/markup/reference/hotel-reservation
I've sent a test e-mail containing the JSON markup multiple times to my Gmail account, opened the e-mail, then refreshed my Google Now app's feed multiple times, but no Reservation Card showing there.
I do get some other types of cards, such as local weather info, event reminders from my calendar, etc. I checked the settings on my Google account and Android phone multiple times, tried to use different accounts and phones from my colleagues, but it won't show ANYWHERE.
HOWEVER :
Viewing the source from the e-mail, I was able to confirm that the expected markup was there, and even managed to validate it using the following Google tool : https://www.google.com/webmasters/markup-tester/
Using my Google account, I'm able to see that my Google Card history contains a "travel" type card, supposedly received today, and that appears on every phone/Google account I've tested, a few seconds after the booking confirmation e-mail was sent
Based on those informations, I assume the card is recognized somehow by my account, but I don't get why it wouldn't show in the gNow feed ...
Would someone have an idea about that ?
Here is the markup I've sent in the e-mail :
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "LodgingReservation",
"reservationNumber": "872914",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"#type": "Person",
"name": "Max Mustermann"
},
"reservationFor": {
"#type": "LodgingBusiness",
"name": "Verkaufshotel Blaue Linde",
"address": {
"#type": "PostalAddress",
"streetAddress": "Industriestraße 27",
"addressLocality": "Offenburg",
"addressRegion": "Ortenau",
"postalCode": "77656",
"addressCountry": "Deutschland"
},
"telephone": "+49 781 310 55 0"
},
"checkinDate": "2015-11-20T11:00:00-08:00",
"checkoutDate": "2015-11-23T11:00:00-08:00"
}
</script>
#Joffrey Quillet I've tested your markup and was able to generate a Now card, however, I did change the checkinDate and checkoutDate during my test:
"checkinDate": "2015-11-23T13:30:00-08:00",
"checkoutDate": "2015-11-24T11:00:00-08:00"
I have a feeling you're located in a area that doesn't support hotel reservation cards. Per this documentation, "Even if you can turn on Google Now in your country, you might not see every type of Now card."
Here is my result using your markup example:
This is a question about Mapquest Android Maps API.
Does anyone know that the createRoute method is supporting lat/Lng or not in mapquest?
public void createRoute(java.lang.String from, java.lang.String to)
The document I found here:
I have read the "Location Format Documentation" : link
It seems that createRoute method supports lat/Lng.
I tried to input lat/Lng a whole day but it returns me an error message only:
Unable to create route.
Error: -1"
Message:[null]
Are you still seeing this error message? The MapQuest Android Maps API does support lat/lng input for routing. Here is a sample request that uses lat/lng inputs:
private void displayRoute() {
RouteManager routeManager= new
RouteManager( this );
routeManager.setMapView( map );
routeManager.createRoute( "{latLng:{lat:37.765007,lng:-122.239937}}" , "Fremont, CA" );
}
Also, The MapQuest Developer Network has an Android Maps API forum. It is also a good resource to check!
You can write like this
RouteManager routeManager = new RouteManager(this);
routeManager.setMapView(map);
routeManager.createRoute("37.002004,35.322998", "36.802687,34.632812");
or like this
RouteManager routeManager = new RouteManager(this);
routeManager.setMapView(map);
routeManager.createRoute("Any City Name", "Any City Name");
MapQuest is supporting this types