Class PhotonPlacesProvider
- All Implemented Interfaces:
PlacesProvider
Place search over Photon, the OpenStreetMap search-as-you-type service.
It needs no key. The public server at photon.komoot.io is for light
use; point setBaseUrl at your own instance for production traffic.
Photon returns coordinates with each suggestion, so getDetails answers
from the last results and makes no request.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionautocomplete(String input, String sessionToken, LatLng bias) Suggests places for partial input.getDetails(String placeId, String sessionToken) Resolves a suggestion.static List<PlaceDetails> parseFeatures(Map<String, Object> json) Reads the features of a Photon GeoJSON response.voidsetBaseUrl(String baseUrl) Sets the server,https://photon.komoot.ioby default.voidsetLimit(int limit) Sets the number of suggestions, 6 by default.voidsetTransport(CloudHttpTransport transport) Replaces the HTTP transport, for tests or a custom stack.
-
Constructor Details
-
PhotonPlacesProvider
public PhotonPlacesProvider()
-
-
Method Details
-
setBaseUrl
Sets the server,
https://photon.komoot.ioby default.Parameters
baseUrl: the server URL
-
setLimit
public void setLimit(int limit) Sets the number of suggestions, 6 by default.
Parameters
limit: the count
-
setTransport
Replaces the HTTP transport, for tests or a custom stack.
Parameters
transport: the transport
-
autocomplete
public AsyncResource<List<PlacePrediction>> autocomplete(String input, String sessionToken, LatLng bias) Description copied from interface:PlacesProviderSuggests places for partial input.
Parameters
-
input: what the user typed -
sessionToken: groups the requests of one search for billing; may be ignored -
bias: prefers results near this point, may be null
Returns
the suggestions
- Specified by:
autocompletein interfacePlacesProvider
-
-
getDetails
Description copied from interface:PlacesProviderResolves a suggestion. This ends the session the token names.
Parameters
-
placeId: the ID of a prediction -
sessionToken: the token used for the autocomplete requests
Returns
the details
- Specified by:
getDetailsin interfacePlacesProvider
-
-
parseFeatures
Reads the features of a Photon GeoJSON response.
Parameters
json: the parsed response
Returns
one entry per feature with a point geometry
-