@bagage/leaflet.restoreview

Save and restore view from localStorage

Usage no npm install needed!

<script type="module">
  import bagageLeafletRestoreview from 'https://cdn.skypack.dev/@bagage/leaflet.restoreview';
</script>

README

Leaflet.RestoreView

Stores and restores map view using localStorage.

First call on restoreView() will setup event listening and view save.

Check out demo.

Note: This plugin uses localStorage to store data, if your browser denies storing local data, this will not work.

Usage

    if (!map.restoreView()) {
        map.setView([50.5, 30.51], 15);
    }

Authors

Makina Corpus