https://github.com/pirxpilot/tile-cache
Client side slippy tile cache
https://github.com/pirxpilot/tile-cache
Last synced: 5 months ago
JSON representation
Client side slippy tile cache
- Host: GitHub
- URL: https://github.com/pirxpilot/tile-cache
- Owner: pirxpilot
- Created: 2017-04-20T16:16:45.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2025-02-05T18:22:12.000Z (over 1 year ago)
- Last Synced: 2025-04-09T21:53:07.891Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 105 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
[![NPM version][npm-image]][npm-url]
[![Build Status][build-image]][build-url]
[![Dependency Status][deps-image]][deps-url]
# tile-cache
Client side splippy tile cache
## Install
```sh
$ npm install --save tile-cache
```
## Usage
The following collections/stores are provided by tile cache:
- tile - map tiles
- font - glyphs needed to render labels
- json - styles and other json data
- image - sprites
`tile-cache` methods take a store name as the first parameter. The examples below us `tile` store.
```js
const tileCache = require('tile-cache');
const key = [0, 3, 5]; // x, y, zoom
let tile; // Blob or ArrayBuffer representing tile
await tileCache.put('tile', key, tile);
// tile is now in cache
tile = await tileCache.get('tile', key);
// tile retrieved
const inCache = await tileCache.check('tile', key);
// inCache is truthy is tile was in cache
await tileCache.remove('tile', key);
// specific tile is removed from cache
await tileCache.drop('tile');
```
## License
MIT © [Damian Krzeminski](https://furkot.com)
[npm-image]: https://img.shields.io/npm/v/tile-cache
[npm-url]: https://npmjs.org/package/tile-cache
[build-image]: https://img.shields.io/github/actions/workflow/status/pirxpilot/tile-cache/check.yaml?branch=main
[build-url]: https://github.com/pirxpilot/tile-cache/actions/workflows/check.yaml
[deps-image]: https://img.shields.io/librariesio/release/npm/tile-cache
[deps-url]: https://libraries.io/npm/tile-cache