Class OrderedTileDataSource

java.lang.Object
com.massifmaps.datasources.TileDataSource
com.massifmaps.datasources.OrderedTileDataSource

public class OrderedTileDataSource extends TileDataSource
A tile data source that combines two data sources (usually offline and online).
All requests are made first to first data source. If not found the request will be made to the second data source.
  • Constructor Details

    • OrderedTileDataSource

      public OrderedTileDataSource(TileDataSource dataSource1, TileDataSource dataSource2)
      Constructs a combined tile data source object.
      Parameters:
      dataSource1 - First data source that is used first if found
      dataSource2 - Second data source that is used only if dataSource1 tile is not found
  • Method Details

    • getMinZoom

      public int getMinZoom()
      Description copied from class: TileDataSource
      Returns the minimum zoom level supported by this data source.
      Overrides:
      getMinZoom in class TileDataSource
      Returns:
      The minimum zoom level supported (inclusive).
    • getMaxZoom

      public int getMaxZoom()
      Description copied from class: TileDataSource
      Returns the maximum zoom level supported by this data source.
      Overrides:
      getMaxZoom in class TileDataSource
      Returns:
      The maximum zoom level supported (exclusive).
    • getDataExtent

      public MapBounds getDataExtent()
      Description copied from class: TileDataSource
      Returns the extent of the tiles in this data source.
      The bounds are in coordinate system of the projection of the data source.
      Overrides:
      getDataExtent in class TileDataSource
      Returns:
      The extent of the data source.
    • getContainerMetaData

      public String getContainerMetaData(String key)
      Description copied from class: TileDataSource
      Reads one entry of the source's own metadata, when it has any - the MBTiles or PMTiles
      metadata table, for instance. Sources that carry none return an empty string, as do keys
      they do not define. Unlike the meta data map above this is read-only and is NOT attached
      to the loaded tiles: a container's metadata can be tens of kilobytes.
      Overrides:
      getContainerMetaData in class TileDataSource
      Parameters:
      key - The metadata key, as named by the container's specification.
      Returns:
      The value, or empty string if the source does not provide it.
    • loadTile

      public TileData loadTile(MapTile tile)
      Description copied from class: TileDataSource
      Loads the specified tile.
      Note: the tile coordinate system used here is vertically flipped relative to layer tile coordinate system.
      Overrides:
      loadTile in class TileDataSource
      Parameters:
      tile - The tile to load.
      Returns:
      The tile data. If the tile is not available, null may be returned.