Search code examples
fluttergoogle-places-api

Flutter and google places API results


hope someone can help me with this.

I've managed to return search autocomplete results and for the most part everything is ok and results are almost restricted to the area but ocassionaly I get areas outside of the radius when non of the queried letters match the area.

However I want to apply restrictions to display results that are only in the specified area/radius. I've tried applying strictbounds parameter, but strictbounds combined with types : 'address' is just showing no results or single result. When I remove types the results automatically show only points of interest which I don't need. Only need addresses.

Anyone have any idea whats wrong in this?

Uri uri = Uri.https("maps.googleapis.com", "maps/api/place/autocomplete/json", {
  "input": query,
  "location": poznanLocation,
  "language": "pl",
  "radius": searchRadius,
  "key": apiKey,
  "bounds": "52.22,15.33|53.13,17.36",
  "strictbounds": "true",
  "types": "address",
  "sessiontoken": _sessionToken,
});

Solution

  • Are you sure there are suitable results that should be returned?

    Depending on the values of location and radius(*), there may be no suitable results left after adding both strictbounds and types=address.

    If results are returned when removing strictbounds, are they strictly within the region defined by location and radius? If they are, please file a bug. Otherwise, that is precisely the intended behavior of strictbounds.

    (*) The Place Autocomplete web service will ignore the bounds parameter, because it is not supported.