Example:
map.addSource('some id', {
type: 'raster',
tiles: ['https://img.nj.gov/imagerywms/Natural2015?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&transparent=true&width=256&height=256&layers=Natural2015'],
tileSize: 256
});
Methods
-
Reloads the source data and re-renders the map.
Example:
map.getSource('source-id').reload();
-
setTiles(tiles) → RasterTileSource
-
Sets the source `tiles` property and re-renders the map.
Name Type Description tiles
Array.<string> An array of one or more tile source URLs, as in the TileJSON spec. Returns:
Returns itself to allow for method chaining.Example:
map.addSource('source-id', { type: 'raster', tiles: ['https://some_end_point.net/{z}/{x}/{y}.png'], tileSize: 256 }); // Set the endpoint associated with a raster tile source. map.getSource('source-id').setTiles(['https://another_end_point.net/{z}/{x}/{y}.png']);
-
setUrl(url) → RasterTileSource
-
Sets the source `url` property and re-renders the map.
Name Type Description url
string A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox:// `. Returns:
Returns itself to allow for method chaining.