An open API service indexing awesome lists of open source software.

https://github.com/hermanho/react-leaflet-pouchdb-tilelayer


https://github.com/hermanho/react-leaflet-pouchdb-tilelayer

pouchdb react react-leaflet tilelayer

Last synced: 9 months ago
JSON representation

Awesome Lists containing this project

README

          

# react-leaflet-pouchdb-tilelayer

[![version](https://img.shields.io/npm/v/react-leaflet-pouchdb-tilelayer.svg?style=plastic)](http://npm.im/react-leaflet-pouchdb-tilelayer)

[![leaflet compatibility](https://img.shields.io/npm/dependency-version/react-leaflet-pouchdb-tilelayer/peer/leaflet.svg?style=plastic)](https://github.com/hermanho/react-leaflet-pouchdb-tilelayer)
[![react-leaflet compatibility](https://img.shields.io/npm/dependency-version/react-leaflet-pouchdb-tilelayer/peer/react-leaflet.svg?style=plastic)](https://github.com/hermanho/react-leaflet-pouchdb-tilelayer)
[![react compatibility](https://img.shields.io/npm/dependency-version/react-leaflet-pouchdb-tilelayer/peer/react.svg?style=plastic)](https://github.com/hermanho/react-leaflet-pouchdb-tilelayer)
[![pouchdb compatibility](https://img.shields.io/npm/dependency-version/react-leaflet-pouchdb-tilelayer/peer/pouchdb.svg?style=plastic)](https://github.com/hermanho/react-leaflet-pouchdb-tilelayer)

React version of [Leaflet.TileLayer.PouchDBCached](https://github.com/MazeMap/Leaflet.TileLayer.PouchDBCached)

## Installation

### Install via NPM

```bash
npm i react-leaflet-pouchdb-tilelayer --save
```
OR
```bash
npm i react-leaflet-pouchdb-tilelayer@3.2.2-beta --save
```

### Demo

https://codesandbox.io/p/sandbox/strange-field-t7l4ly

### Usage with React-Leaflet v3

This plugin is compatible with version 2 of React-Leaflet

```javascript
import { Map, TileLayer, LayersControl } from "react-leaflet";
import PouchDBTileLayer from "react-leaflet-pouchdb-tilelayer";









;
```

## Control options

### position

`{ useCache: true }`

Enable the cache logic

### saveToCache

`{ saveToCache: true }`

Save the map tile to PouchDB

### useOnlyCache

`{ useOnlyCache: false }`

Load from PouchDB cache and do not download from web

### cacheFormat

`{ cacheFormat: 'image/png' }`

The mine type

### cacheMaxAge

`{ cacheMaxAge: 3600000 }`

cache age in millisecond unit

### cacheNextZoomLevel

`{ cacheNextZoomLevel: true }`

pre-load and cache the next level tile

## Development
1. Clone the project
2. Run ```npm install```
3. Run ```npm run build```
4. Start coding