[R-sig-Geo] Leaflet map nested in RShiny App - Improving speed & portability

Erin Stearns e@te@rn@88 @ending from gm@il@com
Wed Sep 5 19:17:15 CEST 2018


Hello all,

Thank you all very much for the great insight!

*McCrea *- thank you very much, I will test using a geojson first, then
test after reducing geometry.

*Tim* - thank you for the great breakdown and recommended priority list.
Ideally, I would like to be able to share the interactive map with
teammates as a file or something akin to it such that they can simply open
it and interact with the map. RInno is a great option, however I run a
linux machine, so will look into further, but may need to find another
option.

*Roman* - the app is currently deployed to shinyapps.io. Thank you for
sharing about ShinyProxy -- so would this method require 1. Internet and 2.
local installation (vs internal server)?

*Barry* - wow, thank you for your response! Sounds like this would be the
best way to solve both issues. I am not as fluent with HTML and JS, but as
you say, there are likely great guides available to take this route.

Thank you all again, this has been hugely helpful. I wish you all the best
and hope I can be of help to you at some point!

Best,
Erin


On Wed, Sep 5, 2018 at 12:48 AM Barry Rowlingson <
b.rowlingson using lancaster.ac.uk> wrote:

>
>
> On Wed, Sep 5, 2018 at 12:56 AM, Erin Stearns <estearns88 using gmail.com>
> wrote:
>
>> Hello all!
>>
>> I hope this message finds you all well!
>>
>> I have 2 questions pertaining to the creation of interactive maps via
>> Leaflet nested inside an RShiny app. One question has to do with
>> computation while the other has to do with sharing/off-line interactivity.
>>
>> *Computation question*
>> As you see, the RShiny app takes quite a bit of time to render. Does
>> anyone
>> have any suggestions for improving this? As previously said, this version
>> only contains 5 countries, thus I cannot continue with my current method
>> to
>> reach a global map. I have considered finding centroids of all Admin 2
>> polygons and retaining attribute information here, then rasterizing the
>> malaria risk shapefile for visualization and using the 2 instead of a
>> single shapefile with polygon boundaries and attributes.
>>
>>
> Unless you plan to add any computational functions to this map then I'd
> strongly recommend creating it as a standalone web app and not a shiny app.
> This will enable you to use lots of useful Leaflet plugins for speeding
> things up, such as only showing country outlines at low zoom levels, and
> showing subdivisions only at high zoom levels. This *might* be possible
> with R's various leaflet packages but I'd go for full javascript control.
>
> A standalone map would take its data from a JSON file or similar, and you
> would then be writing R code that generated that. The mapping app itself is
> written in HTML and JS with CSS styling. There are plenty of guides to
> web-based interactive mapping, starting with Leaflet.
>
>
>> *Sharing the app/offline interactivity*
>> I am planning to share this with people who likely do not have R installed
>> on their laptops nor have they ever coded. Does anyone have any
>> suggestions
>> for the best way to do this while retaining interactivity?
>>
>>  Here's the big win of creating a standalone web map. You only have to
> distribute the HTML/CSS/JS and they can be viewed directly (or you also
> supply a tiny server that runs locally and only has to feed the files on a
> localhost port). No need to have a shiny server anywhere, or install R. Its
> simple and clean. It also needs no network connectivity, but you'll not get
> a base map - but you could include a low or medium resolution basemap
> raster in your package.
>
> The only reason to need Shiny here would be if you wanted people to do
> something computational, like click on a bunch of polygons and then fit a
> linear model to the selection, since that would require a round-trip to the
> server for R to compute the fit. (although I suspect there's a JS package
> for linear modelling.... you can do ML in JS these days...)
>
>
>
>> Thank you all, any insight is greatly appreciated.
>>
>> Best,
>> Erin
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo using r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list