Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Places Nearby search results - missing detail Data?

I'm currently working on a project in which we perform "Nearby" queries for places using keywords, and then we make follow-up "Detail" requests to obtain more information about specific places of interest.

With Google's new pricing model in the works, the documentation warns about the cost of the Nearby search, but the warning seems to imply that the follow-up detail request will no longer be necessary because our original search should give us everything we need:

By default, when a user selects a place, Nearby Search returns all of the available data fields for the selected place, and you will be billed accordingly. There is no way to constrain Nearby Search requests to only return specific fields. To keep from requesting (and paying for) data that you don't need, use a Find Place request instead.

However, I'm not seeing this. When I run a sample request, the results from my Nearby request contains only minimal data related to the places Google finds. To get details, I still have to do a follow-up detail request.

Does anyone know if there's something I may be overlooking? I'm including my request URL (sans API key).

https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=xxxxxxxxxx&location=30.7329,-88.081987&radius=5000&keyword=insurance

And this is an example of one of the results I received:

{
  "geometry": {
    "location": {
      "lat": 30.69254,
      "lng": -88.0443999
    },
    "viewport": {
      "northeast": {
        "lat": 30.69387672989272,
        "lng": -88.04309162010728
      },
      "southwest": {
        "lat": 30.69117707010728,
        "lng": -88.04579127989273
      }
    }
  },
  "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
  "id": "53744cdc03f8a9726593a767424b14f7f8f86049",
  "name": "Ann M Hartwell - Aflac Insurance Agent",
  "place_id": "ChIJj29KxNZPmogRJovoXjMDpQI",
  "plus_code": {
    "compound_code": "MXV4+26 Mobile, Alabama",
    "global_code": "862HMXV4+26"
  },
  "reference": "CmRbAAAAcHM1P7KgNiZgVOm1pWojLto9Bqx96h2BkA-IyfN5oAz1-OICsRXiZOgwmwHb-eX7z679eFjpzPzey0brgect1UMsAiyawKpb5NLlgr_Pk8wBJpagRcKQF1VSvEm7Nq6CEhCfR0pM5wiiwpqAE1eE6eCRGhQPJfQWcWllOVQ5e1yVpZYbCsD01w",
  "scope": "GOOGLE",
  "types": [
    "insurance_agency",
    "point_of_interest",
    "establishment"
  ],
  "vicinity": "70 N Joachim St, Mobile"
}
like image 845
Steven Avatar asked Jul 10 '18 14:07

Steven


1 Answers

I thought about deleting this question, but I guess I'll leave it up in case anyone else is confused like I was.

It turns out the extra detail fields I was looking for in the Nearby Search results were there...sort of.

Google's new pricing model categorizes place data fields into three tiers: Basic, Contact, and Atmosphere (Basic data is free, but the other two add to the cost).

As part of these changes, Place API calls have been expanded to allow users to specify the data fields they want so that they don't have to pay for that extra data if they don't need it.

The Nearby Search query, as per the note in the question, includes all the data fields available, and doesn't support a parameter for controlling the data -- it's always going return data that falls into the [Basic + Contact + Atmosphere] bucket.

So far, that's all well and good.

Where things became confusing to me, though, is the specifics of what is included in the different data tiers. I skimmed through these notes several times before I noticed the contents were different.

This is how the fields break down with the Places details request:

Basic

The Basic category includes the following fields: address_component, adr_address, alt_id, formatted_address, geometry, icon, id, name, permanently_closed, photo, place_id, plus_code, scope, type, url, utc_offset, vicinity

Contact

The Contact category includes the following fields: formatted_phone_number, international_phone_number, opening_hours, website

Atmosphere

The Atmosphere category includes the following fields: price_level, rating, review

And this is how it looks for the Places search request:

Basic

The Basic category includes the following fields: formatted_address, geometry, icon, id, name, permanently_closed, photos, place_id, plus_code, scope, types

Contact

The Contact category includes the following field: opening_hours (Place Search returns only open_now; use a Place Details request to get the full opening_hours results). Atmosphere

The Atmosphere category includes the following fields: price_level, rating

I haven't found documentation for it, specifically, but the results from a Nearby Search request seems close (but not identical) to the Place search (including Contact and Atmosphere).

I had originally thought the fact that Nearby Search results now include Contact and Atmosphere data (when available), that meant it would contain all the fields itemized as Contact and Atmosphere data in the Place details documentation, but that's not the case.

like image 156
Steven Avatar answered Jan 03 '23 07:01

Steven