Places: PlaceAutocompleteType is missing values
Environment details
Library version: 2.1.2
Code example
PlacesApi.placeAutocomplete(someContext, "Zurich", new PlaceAutocompleteRequest.SessionToken())
.types(PlaceAutocompleteType.ESTABLISHMENT)
2 issues:
- The PlaceAutocompleteType enum only covers a small subset of available types according to https://developers.google.com/maps/documentation/places/web-service/supported_types#table2
- There is no way to use multiple types, which is possible via REST calls.
- The PlaceAutocompleteType enum only covers a small subset of available types according to https://developers.google.com/maps/documentation/places/web-service/supported_types#table2
Found workaround with .custom method:
PlacesApi.placeAutocomplete(someContext, "Zurich", new PlaceAutocompleteRequest.SessionToken())
.custom("types", "route")
- There is no way to use multiple types, which is possible via REST calls.
You can chain calls to have multiple types:
PlacesApi.placeAutocomplete(someContext, "Zurich", new PlaceAutocompleteRequest.SessionToken())
.types(PlaceAutocompleteType.ESTABLISHMENT)
.types(PlaceAutocompleteType.ADDRESS)
Actually I just tried to chain calls and the last value overwrites the first one :(
-
In an Autocomplete request, it is possible to filter by at most one element of the types contained in the enum PlaceAutocompleteType. This is correct https://developers.google.com/maps/documentation/places/web-service/autocomplete?hl=it#types
-
What should be added is the possibility to filter an autocomplete request with multiple types that are not part of the enum
PlaceAutocompleteType.
For example, we could introduce on PlaceAutoCompleteRequest:
/**
* Restricts the results to places matching the specified types
*
* @param types The {@link PlaceType}s to restrict results to.
* @return Returns this {@code PlaceAutocompleteRequest} for call chaining.
*/
public PlaceAutocompleteRequest types(PlaceType... types) {
return param("types", join('|', types));
}
What do you think @n10v ?
- The link is leading to the following URL, which shows 0 issues for me (probably the issues are private): https://github.com/googlemaps/google-maps-services-java/issues/url
- Makes sense!
I'm sorry @n10v , I sent the wrong link. I just corrected it. I will try to send a pull request asap