0.0.6 • Published 4 years ago

@isias/isi.offlinemap v0.0.6

Weekly downloads
2
License
ISC
Repository
-
Last release
4 years ago

Offline layer for leaflet in Electron

based on https://github.com/allartk/leaflet.offline

Saves map tiles to indexdb

use the offlinelayer in Leaflet

import {tileLayers} from 'isi.offlinemap';

this.myMap = L.map('mapid')
tileLayers.offline('https://opencache.statkart.no/gatekeeper/gk/gk.open?', {
  layers: 'topo4',
  format: 'image/png',
  transparent: false,
  version: "1.0.0",
  attribution: "Kartverket",
  type: 'wms',
  tms: true,
  maxZoom: 20,
  maxNativeZoom: 20
}).addTo(this.myMap);

Save tiles to indexdb (must run in render process)

  const offlineMap = require('isi.offlinemap').saveTiles
  const gpsTrack =  [{lat:62.312,lon:7.623},...];

  // asyc
  (async () => {
    try {
      await offlineMap.downloadTrackTiles(gpsTrack,(total,current) => {
        // progress callback, shows download progress of tiles    
      });
    } catch (e) {
      console.log('error',e);
    }
  })
  
0.0.6

4 years ago

0.0.5

5 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago