Class VectorTileSearchService

java.lang.Object
com.massifmaps.search.VectorTileSearchService

public class VectorTileSearchService extends Object
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.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a VectorTileSearchService for the given vector data source and vector tile decoder.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    int
    Returns the maximum number of results the search service returns.
    int
    Returns the maximum zoom level of vector tiles used.
    By default the maximum zoom level is specified by data source.
    int
    Returns the minimum zoom level of vector tiles used.
    By default the minimum zoom level is specified by data source and is usually 0.
    boolean
    Returns wether to prevent duplicate elements
    Returns the projection the results are expressed in, which is the data source's.
    boolean
    Returns wether result features are sorted by distance
    Returns the tile decoder used by the search service.
    void
    Sets the layers to filter.
    void
    setMaxResults(int maxResults)
    Sets the maximum number of results the search service returns.
    The default number of results is 1000.
    void
    setMaxZoom(int maxZoom)
    Sets the maximum zoom level of vector tiles used.
    void
    setMinZoom(int minZoom)
    Sets the minimum zoom level of vector tiles used.
    void
    setPreventDuplicates(boolean preventDuplicates)
    Sets wether to prevent duplicate elements (present in different tiles)
    void
    setSortByDistance(boolean sortByDistance)
    Sets wether to sort result features by distance

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VectorTileSearchService

      public VectorTileSearchService(TileDataSource dataSource, VectorTileDecoder tileDecoder)
      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

      public TileDataSource getDataSource()
      Returns the tile data source of the search service.
      Returns:
      The tile data source of the search service.
    • getProjection

      public Projection getProjection()
      Returns the projection the results are expressed in, which is the data source's.
      Returns:
      The projection of the found features' positions.
    • getTileDecoder

      public VectorTileDecoder 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

      public StringVector getLayers()
      Returns the layers to filter while decoding tiles.
      Returns:
      The list of layers.
    • setLayers

      public void setLayers(StringVector layers)
      Sets the layers to filter.
    • findFeatures

      public VectorTileFeatureCollection findFeatures(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.
      Parameters:
      request - The search request containing search filters.
      Returns:
      The resulting feature collection containing features matching the request.