TileCache url function for OpenLayers
Allows create custom ol.TileUrlFunctionType
to load tiles
seeded with TileCache.
Installation
Install it with NPM (recommended):
# ES6 version for bundling with Webpack, Rollup and etc. npm install ol ol-tilecache
// Use as ES2015 module (based on NPM package `ol`)...// or only what you need
Or add from CDN:
Usage
Usage same as standard OpenLayers tile url functions.
Members
createTileUrlFunction
Arguments
url : string
URL templatetileGrid : ol.tilegrid.TileGrid
Custom tile grid. Default is EPSG:3857 x/y/z grid
Returns: ol.TileUrlFunctionType
Available URL placeholders:
z | 0z - zoom level (simple number or padded with zero)
x1, x2, x3 - X axis index parts (remnant from dividing the tile X index on 10^9 broken down by 3 digits)
y1, y2, y3 - Y axis index parts (remnant from dividing the tile Y index on 10^9 broken down by 3 digits)
-y1, -y2, -y3 - inverted Y axis index parts (remnant from dividing the tile Y index on 10^9 broken down by 3 digits)
Example usage:
const map = target: 'map' view: projection: 'EPSG:3857' center: 418997214 750795067 zoom: 5 layers: source: tileUrlFunction:
Build
git clone https://github.com/ghettovoice/ol-tilecache.gitnpm install# build npm run build# run test app npm start# run unit tests npm test
License
MIT (c) 2016-2020, Vladimir Vershinin