Distributing leaflet maps without a server

No Comments

Distributing confidential maps is hard

I’ve been trying, for a while now, to figure out how to use R to replace MapPoint–the challenge has been distributing a map of confidential data to non-R users in my office.

Making the maps isn’t THAT hard: leaflet makes it pretty easy to draw up a map and the ggmap library has the geocode() function, so that’s solved too.

The real problem is, after I build a leaflet map of the VP’s prospects with giving and wealth rating data, how do I send it the VP’s admin assistant so she can work out his travel plans? I can’t put that kind of confidential data on Rpubs. Running and administering a shiny server (not to mention building a shiny app) is too much work for one-off stuff like this–I just want to be able to save the file and email it.

Use saveWidget()

Turns out, the htmlwidgets library has a saveWidget() function. I did something like this:

That makes an html file and a directory of helper functions (css, javascript, etc) on my desktop. I zip the html and the directory up into a single zip file, email that off and call it a day.

It still requires internet access to download the map (by default from Open Street Maps)–I’d like to get that sorted out later on so development officers can throw the html file in Dropbox and open it up when they’re on the road–but for now, using saveWidget() seems to be the way to go!

Categories: plotting Tags: Tags: , , ,