Package com.massifmaps.search
Class VectorTileSearchService
java.lang.Object
com.massifmaps.search.VectorTileSearchService
A search service for finding features from the specified vector tile data source.
Depending on the datasource, searching may perform network requests and must be executed in non-UI background thread.
Depending on the datasource, searching may perform network requests and must be executed in non-UI background thread.
-
Constructor Summary
ConstructorsConstructorDescriptionVectorTileSearchService(TileDataSource dataSource, VectorTileDecoder tileDecoder) Constructs a VectorTileSearchService for the given vector data source and vector tile decoder. -
Method Summary
Modifier and TypeMethodDescriptionfindFeatures(SearchRequest request) Searches for the features specified by search request from the vector tiles bound to the service.
The zoom level range used for searching is specified using minZoom/maxZoom attributes of the search service.
Depending on the data source, this method may perform slow IO operations and may need to be run in background thread.Returns the tile data source of the search service.Returns the layers to filter while decoding tiles.intReturns the maximum number of results the search service returns.intReturns the maximum zoom level of vector tiles used.
By default the maximum zoom level is specified by data source.intReturns the minimum zoom level of vector tiles used.
By default the minimum zoom level is specified by data source and is usually 0.booleanReturns wether to prevent duplicate elementsReturns the projection the results are expressed in, which is the data source's.booleanReturns wether result features are sorted by distanceReturns the tile decoder used by the search service.voidsetLayers(StringVector layers) Sets the layers to filter.voidsetMaxResults(int maxResults) Sets the maximum number of results the search service returns.
The default number of results is 1000.voidsetMaxZoom(int maxZoom) Sets the maximum zoom level of vector tiles used.voidsetMinZoom(int minZoom) Sets the minimum zoom level of vector tiles used.voidsetPreventDuplicates(boolean preventDuplicates) Sets wether to prevent duplicate elements (present in different tiles)voidsetSortByDistance(boolean sortByDistance) Sets wether to sort result features by distance
-
Constructor Details
-
VectorTileSearchService
Constructs a VectorTileSearchService for the given vector data source and vector tile decoder.- Parameters:
dataSource- The vector data source to search from.tileDecoder- The vector tile decoder to use for decoding the tiles.
-
-
Method Details
-
getDataSource
Returns the tile data source of the search service.- Returns:
- The tile data source of the search service.
-
getProjection
Returns the projection the results are expressed in, which is the data source's.- Returns:
- The projection of the found features' positions.
-
getTileDecoder
Returns the tile decoder used by the search service.- Returns:
- The tile decoder used by the search service.
-
getMinZoom
public int getMinZoom()Returns the minimum zoom level of vector tiles used.
By default the minimum zoom level is specified by data source and is usually 0.- Returns:
- The minimum zoom level of vector tiles used.
-
setMinZoom
public void setMinZoom(int minZoom) Sets the minimum zoom level of vector tiles used.- Parameters:
minZoom- The new minimum zoom level.
-
getMaxZoom
public int getMaxZoom()Returns the maximum zoom level of vector tiles used.
By default the maximum zoom level is specified by data source.- Returns:
- The maximum zoom level of vector tiles used.
-
setMaxZoom
public void setMaxZoom(int maxZoom) Sets the maximum zoom level of vector tiles used.- Parameters:
maxZoom- The new maximum zoom level.
-
getMaxResults
public int getMaxResults()Returns the maximum number of results the search service returns.- Returns:
- The maximum number of results the search service returns.
-
setMaxResults
public void setMaxResults(int maxResults) Sets the maximum number of results the search service returns.
The default number of results is 1000.- Parameters:
maxResults- The new maximum number of results the geocoding service returns.
-
getSortByDistance
public boolean getSortByDistance()Returns wether result features are sorted by distance- Returns:
- wether result features are sorted by distance
-
setSortByDistance
public void setSortByDistance(boolean sortByDistance) Sets wether to sort result features by distance- Parameters:
sortByDistance- wether to sort result features by distance
-
getPreventDuplicates
public boolean getPreventDuplicates()Returns wether to prevent duplicate elements- Returns:
- wether to prevent duplicate elements
-
setPreventDuplicates
public void setPreventDuplicates(boolean preventDuplicates) Sets wether to prevent duplicate elements (present in different tiles)- Parameters:
preventDuplicates- wether to prevent duplicate elements
-
getLayers
Returns the layers to filter while decoding tiles.- Returns:
- The list of layers.
-
setLayers
Sets the layers to filter. -
findFeatures
Searches for the features specified by search request from the vector tiles bound to the service.
The zoom level range used for searching is specified using minZoom/maxZoom attributes of the search service.
Depending on the data source, this method may perform slow IO operations and may need to be run in background thread.- Parameters:
request- The search request containing search filters.- Returns:
- The resulting feature collection containing features matching the request.
-