public final class BundledTileSource

  1. Object
  2. BundledTileSource

ImplementsTileSource

A TileSource that loads tiles from application resources bundled into the app (the classpath), with no network access. It powers offline maps and, crucially, the deterministic map screenshot tests: a small fixture tileset is shipped as a resource and rendered identically on every run.

The resource path is a template containing the literal tokens {z}, {x} and {y} (for example /maptiles/{z}/{x}/{y}.mvt).

Constructors

public BundledTileSource(String pathTemplate, boolean vector, int minZoom, int maxZoom)Creates a bundled source.

Methods

public BundledTileSource setAttribution(String attribution)Sets the attribution string shown over the map.
public boolean isVector()True for MVT vector tiles, false for raster image tiles.
public int getTileSize()The tile edge in pixels (almost always 256).
public int getMinZoom()The smallest zoom level this source serves.
public int getMaxZoom()The largest zoom level this source serves.
public String getAttribution()Attribution text that must be displayed over the map.
public void fetchTile(int z, int x, int y, TileCallback callback)Requests the tile at z/x/y, delivering the result to callback on the event dispatch thread.

Inherited methods

Constructor details

BundledTileSource

public BundledTileSource(String pathTemplate, boolean vector, int minZoom, int maxZoom)
Creates a bundled source.

Parameters

pathTemplate String
a resource path containing {z}/{x}/{y} tokens
vector boolean
true for MVT tiles, false for raster image tiles
minZoom int
the smallest available zoom
maxZoom int
the largest available zoom

Method details

setAttribution

public BundledTileSource setAttribution(String attribution)
Sets the attribution string shown over the map.

isVector

public boolean isVector()
True for MVT vector tiles, false for raster image tiles.

getTileSize

public int getTileSize()
The tile edge in pixels (almost always 256).

getMinZoom

public int getMinZoom()
The smallest zoom level this source serves.

getMaxZoom

public int getMaxZoom()
The largest zoom level this source serves.

getAttribution

public String getAttribution()
Attribution text that must be displayed over the map.

fetchTile

public void fetchTile(int z, int x, int y, TileCallback callback)
Requests the tile at z/x/y, delivering the result to callback on the event dispatch thread.