TopcuM / leaflet-save

A leaflet plugin that provides a hook to save the map state as JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

leaflet-save

A leaflet plugin that provides a hook to save the map state as JSON.

    var state = map.save();
    // post state to an endpoint
    // http.post(mapState);

    // save state to local storage
    // localStorage.set('map', mapState);

    console.log(state);
{
    "zoom": 4,
    "center": [
        46.07323062540835,
        -99.27246093750001
    ],
    "bounds": [
        [
            68.46379955520322,
            -127.88085937500001
        ],
        [
            8.928487062665504,
            -70.66406250000001
        ]
    ]
}

About

A leaflet plugin that provides a hook to save the map state as JSON.

License:MIT License


Languages

Language:HTML 67.9%Language:JavaScript 32.1%