-1

I am using a Google Places API to return ratings for an entered property. When I enter the property name as the search term, a rating is returned, but if I attempt to return a rating by using an address (which is supported by the text input) I do not receive a response. I have tried searching an address through the API, returning a Place ID and then using the Place ID to return a rating, but that does not work.

This API returns a rating: https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=The+Shops+At+Chestnut+Hill&inputtype=textquery&fields=rating&key=[MY API_KEY]

This is the same property, but searched by address, which does not: https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=199+Boylston+St+Chestnut+Hill+MA&inputtype=textquery&fields=rating&key=[MY API_KEY]

Is there something different with the formatting of address inputs I am not doing correctly?

CESBoston
  • 83
  • 1
  • 10
  • Possible duplicate of [Google maps details API does not return fields](https://stackoverflow.com/questions/58204065/google-maps-details-api-does-not-return-fields) – MrUpsidown Oct 18 '19 at 07:52

1 Answers1

0

The places API has separate ids for the address/building and the establishment in it. The address/building won't have the rating, the place/establishment will.

From the PlaceId Finder

The Shops at Chestnut Hill
Place ID: ChIJkcWRbZF444kRJUJjXdUFIOw

199 Boylston St
Place ID: ChIJ4TgqFZF444kR2XHKhTgsiNs

(although I do see an entry in the dropdown for the "place" when I enter the address)

The Places API nearbySeach only returns places, not address place ids. The geocoder returns the place_id of the address. But the nearbySearch takes a set of coordinates, not an address, so to get those results from an address requires two calls, one to geocode the address, one to get the nearbySearch results from that location.

Note that there are multiple results at the location of that address (4 exactly at the location returned from geocoding "199 Boylston St Chestnut Hill MA", and 15 other places that are nearby and in the footprint of "The Shops at Chestnut Hill"), more if you use pagination to get more than 20 results.

geocodezip
  • 158,664
  • 13
  • 220
  • 245