1
votes

I'm currently working on an app that needs to be able to receive data about multiple locations within a specific area using Google's Map and Places API.

I have google maps, places, and basic requests working but I'm having trouble achieving the functionality above.

In the Google Places API documentation it says a parameter for their 'Find Place' request can be a rectangular area (aka locationbias - defined by a northwest and a south east coordinate) but that only returns a single result. On the other hand, their 'Search Nearby' request is returns multiple locations, but doesn't seem to accept the same rectangular locationbias as a parameter.

The reason I'm trying to stay away from using the 'radius' with the 'Search Nearby' request is because i need users to be able to request location information given the map's bounds (basically get information about locations in the visible area of the map for them)

Google API documentation I've been referencing: https://developers.google.com/places/web-service/search

Is there any way to use Google's Places API 'Nearby Search' request to return data for multiple locations given a rectangular area?

1
Did you ever find an answer to this? - Noah

1 Answers

2
votes

As per these related posts in Google Maps Platform's Public Issue tracker: https://issuetracker.google.com/issues/117569668

https://issuetracker.google.com/issues/112000709

https://issuetracker.google.com/issues/35827732

The location+radius parameters are used to define a "viewport", which is a rectangular region within which results are returned. Places API will approximate your location and radius to a roughly rectangular region (as typically defined by bounds in the Geocoding API) that fits the circle defined by your location and radius.

Given that intended behavior, it seems to fit your use-case to request location information within a map's rectangular bounds.

Hope this helps!