- openDB() ⇒
boolean
Open database 'leaflet-maps' from IndexedDB storage
- setLayer(object) ⇒
none
Set a baseLayer, also this Control and its baseLayer to have the same DB table
- setTable(table)
Sets the current DB table for Control and its TileLayer
- deleteTable(table) ⇒
Promise.<void>
Delete a table from DB
- putItem(table) ⇒
Promise.<void>
Add/Update an item in DB table
- getItem(table) ⇒
Promise.<void>
Get an item in DB table
- deleteItem(table) ⇒
Promise.<void>
Delete an item in DB table
- setZoomlevels(zoomlevels)
Set options zoomlevels
- setBounds(bounds)
Set Lat/Lng bounds of map to save
- setStorageSize(function)
Sets status.storagesize equal to count of table rows
- saveMap()
Prepare zoom levels to download and activate callback function to save(async) all map tiles on table name confirmation. Fires event 'savestart'.
- getTileUrls(zoom) ⇒
Array.<object>
getTileUrls for single zoomlevel
- ControlStatus :
Object
Status of ControlSaveTiles, keeps info about process during downloading and saving tiles. Used internal and as object for events.
Kind: global class
Properties
Name | Type | Description |
---|---|---|
status | ControlStatus |
|
baseLayer | TileLayerOffline |
TileLayer to control |
dtable | object |
DB table associated with baseLayer https://dexie.org/docs/Table/Table |
Control to save tiles, invisible by default
Example
const controlSaveTiles = L.control.savetiles(myTileLayerOffline, {
zoomlevels: [13, 16], // optional zoomlevels to save, default current zoomlevel
maxZoom: 17
});
Kind: global class
Properties
Name | Type | Description |
---|---|---|
dtable | object |
database table to get tiles from https://dexie.org/docs/Table/Table |
offtest | boolean |
simulate offline response or not |
A layer that uses IndexedDB store tiles when available. Falls back to online.
Open database 'leaflet-maps' from IndexedDB storage
Kind: global function
Returns: boolean
- result - false when not found or error
Set a baseLayer, also this Control and its baseLayer to have the same DB table
Kind: global function
Param | Type | Description |
---|---|---|
object | TileLayerOffline |
TileLayerOffline |
Sets the current DB table for Control and its TileLayer
Kind: global function
Param | Type | Description |
---|---|---|
table | string |
name |
Delete a table from DB
Kind: global function
Returns: Promise.<void>
- fires event 'tblevent' to refresh table list
Param | Type | Description |
---|---|---|
table | string |
name |
Add/Update an item in DB table
Kind: global function
Returns: Promise.<void>
- operation result
Param | Type | Description |
---|---|---|
table | string |
name |
Get an item in DB table
Kind: global function
Returns: Promise.<void>
- operation result
Param | Type | Description |
---|---|---|
table | string |
name |
Delete an item in DB table
Kind: global function
Returns: Promise.<void>
- operation result
Param | Type | Description |
---|---|---|
table | string |
name |
Set options zoomlevels
Kind: global function
Param | Type | Description |
---|---|---|
zoomlevels | array |
array of zoom values |
Set Lat/Lng bounds of map to save
Kind: global function
Param | Type | Description |
---|---|---|
bounds | LatLngBounds |
https://leafletjs.com/reference-0.7.7.html#latlngbounds |
Sets status.storagesize equal to count of table rows
Kind: global function
Param | Type | Description |
---|---|---|
function | callback |
to get the count |
Prepare zoom levels to download and activate callback function to save(async) all map tiles on table name confirmation. Fires event 'savestart'.
getTileUrls for single zoomlevel
Kind: global function
Returns: Array.<object>
- the tile urls, key, url
Param | Type |
---|---|
L.latLngBounds | object |
zoom | number |
Status of ControlSaveTiles, keeps info about process during downloading and saving tiles. Used internal and as object for events.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
storagesize | number |
total number of saved tiles. |
lengthToBeSaved | number |
number of tiles that will be saved in db during current process |
lengthSaved | number |
number of tiles saved during current process |
lengthLoaded | number |
number of tiles loaded during current process |
_tilesforSave | array |
tiles waiting for processing |
tnames | array |
names of all DB tables |