Use Leaflet completely offline

699 views
Skip to first unread message

Marc Brown

unread,
Nov 15, 2012, 11:30:20 AM11/15/12
to leafl...@googlegroups.com
I think this may be a simple question when it comes to building sources and stuff, but my question:

How can I use the Leaflet map offline? Or, at least be able to see the blank, white map it the plus and minus signs in the top left corner when I'm completely offline?

Currently, I have to link the CSS and .js file to http://cdn.leafletjs.com for the map to work. If I make the links to the local /dist folder, the map will not display; it's just a blank webpage

What do I need to do in order to use it offline?

I already installed and configured node, and I also already installed the three file, -g jake, jshint (i think it's called this), and the third one, uglify-js.

Thanks,
Message has been deleted

Mike George

unread,
Nov 26, 2012, 3:36:39 AM11/26/12
to leafl...@googlegroups.com
The problem is with the map tiles, not with Leaflet. You could make a copy of all the map tiles at all zoom levels from your chosen source, but it will take a lot of storage (and could be against their terms of use). If you search for something like "openstreetmap local tiles" you will find some solutions to this, which will automatically download a copy from the tile server if you haven't got it stored locally. When you have viewed an area at a few zoom levels a few times you will have most of the tiles you need stored locally but you will still need an internet connection to get any missing ones.

Andrew Kulinich

unread,
Nov 27, 2012, 1:48:44 AM11/27/12
to leafl...@googlegroups.com
Mike replied already and I will just add some details - you could use Applicatioon Cache (http://www.html5rocks.com/en/tutorials/appcache/beginner/) to list all tiles you would like to make avaiable offline.
Reply all
Reply to author
Forward
0 new messages