java.lang.Object | ||
↳ | com.carto.datasources.TileDataSource | |
↳ | com.carto.datasources.HTTPTileDataSource |
A tile data source that loads tiles using a HTTP connection.
The requests are generated using a template scheme, where tags in the baseURL string are replaced with actual values.
The following tags are supported: s, z, zoom, x, y, xflipped, yflipped, quadkey, frame.
For example, if baseURL = "https://tile.openstreetmap.org/{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 URL: "https://tile.openstreetmap.org/2/1/3.png".
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
HTTPTileDataSource(int minZoom, int maxZoom, String baseURL)
Constructs a HTTPTileDataSource object.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
synchronized void | delete() | ||||||||||
String |
getBaseURL()
Returns the base URL template containing tags.
| ||||||||||
StringMap |
getHTTPHeaders()
Returns the current set of HTTP headers used.
| ||||||||||
StringVector |
getSubdomains()
Returns the subdomains for {s} tag.
| ||||||||||
boolean |
isMaxAgeHeaderCheck()
Returns true/false based on whether the max-age header check is used.
| ||||||||||
boolean |
isTMSScheme()
Returns true/false based whether the TMS tiling scheme is used.
| ||||||||||
TileData |
loadTile(MapTile mapTile)
Loads the specified tile.
| ||||||||||
void |
setBaseURL(String baseURL)
Sets the base URL for the data source.
| ||||||||||
void |
setHTTPHeaders(StringMap headers)
Sets HTTP headers for all requests.
| ||||||||||
void |
setMaxAgeHeaderCheck(boolean maxAgeCheck)
Enables/disables the max-age header check.
| ||||||||||
void |
setSubdomains(StringVector subdomains)
Sets the subdomains for {s} tag.
| ||||||||||
void |
setTMSScheme(boolean tmsScheme)
Enables/disables the TMS tiling scheme.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Constructs a HTTPTileDataSource object.
minZoom | The minimum zoom level supported by this data source. |
---|---|
maxZoom | The maximum zoom level supported by this data source. |
baseURL | The base URL containing tags (for example, "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png"). |
Returns the base URL template containing tags.
Returns the current set of HTTP headers used. Initially this set is empty and can be changed with setHTTPHeaders.
Returns the subdomains for {s} tag. The default is ["a", "b", "c", "d"].
Returns true/false based on whether the max-age header check is used.
If this is enabled, SDK will automatically refresh the tiles when tiles have expired.
Returns true/false based whether the TMS tiling scheme is used.
Loads the specified tile.
Note: the tile coordinate system used here is vertically flipped relative to layer tile coordinate system.
mapTile | The tile to load. |
---|
Sets the base URL for the data source.
baseURL | The base URL containing tags (for example, "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png"). |
---|
Sets HTTP headers for all requests. Calling this method will invalidate the datasource and
all layers using this data source will be refreshed.
headers | A map of HTTP headers that will be used in subsequent requests. |
---|
Enables/disables the max-age header check.
If this is enabled, SDK will automatically refresh the tiles when tiles have expired. The default is disabled.
maxAgeCheck | True if the check should be enabled, false otherwise. |
---|
Sets the subdomains for {s} tag.
subdomains | The list of subdomains to use. |
---|
Enables/disables the TMS tiling scheme. In TMS scheme y coordinate of the tile is flipped. The default is disabled.
tmsScheme | True is TMS tiling scheme should be used. False is XYZ should be used. |
---|