Class AssetTileDataSource

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

public class AssetTileDataSource extends TileDataSource
A tile data source where each map tile is a seperate image file bundled with the application.
The requests are generated using a template scheme, where tags in the basePath string are replaced with actual values.
The following tags are supported: zoom, x, y, xflipped, yflipped, quadkey.

For example, if basePath = "t{zoom}_{x}_{y}.png" and the requested tile has zoom == 2,
x == 1 and y == 3, then the tile will be loaded from the following path: "t2_1_2.png".
  • Constructor Details

    • AssetTileDataSource

      public AssetTileDataSource(int minZoom, int maxZoom, String basePath)
      Constructs an AssetTileDataSource object.
      Parameters:
      minZoom - The minimum zoom level supported by this data source.
      maxZoom - The maximum zoom level supported by this data source.
      basePath - The base path containing tags (for example, "t{zoom}_{x}_{y}.png").
  • Method Details

    • 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.
    • buildAssetPath

      protected String buildAssetPath(String basePath, MapTile tile)