leaflet-color-cache-tile
v0.0.5
Published
leaflet二维瓦片获取并动态改变整体配色方案,并加入持续缓存方案来避免重复请求处理。
Downloads
8
Maintainers
Readme
leaflet-color-cache-tile
Description
leaflet two-dimensional tiles acquire and dynamically change the overall color scheme, and add a continuous caching scheme to avoid repeated request processing
import 'leaflet-color-cache-tile'
L.colorCacheTile(
`http://t{s}.tianditu.gov.cn/vec_w/wmts?xxxx`,
{
...your default options,
<!-- This method is used to adjust the rgb values on all images. pixel is the original rgb value of the image -->
<!-- reference from https://github.com/hnrchrdl/leaflet-tilelayer-colorizr -->
colorize(pixel) {
pixel.r -= 232;
pixel.g -= 214;
pixel.b -= 167;
return pixel;
},
<!-- cache name and cache time -->
<!-- The name is used when multiple tiles are cached, such as a map with geographic information tiles and text information tiles -->
cacheSet(cacheOptions) {
cacheOptions.name = 'tile-vec';
cacheOptions.time = false;
return cacheOptions;
}
}
);