How to speed up brochure on a brilliant server

I installed just the booklet map in brilliant, where brilliant server.R looks like this:

(please get RDS data from Dropbox for reproducible example)

Server .R

 test_polygons <- readRDS('test_polygons.RDS') # Sind die Polygon-Shapefiles transformiert auf WGS84 fΓΌr Bezirke #some merging.... #we use sample data instead test_polygons@data $sample <- runif(nrow( test_polygons@data )) #Create some nice popups world_popup <- function(modell){ niveau <- test_polygons@data [, modell] probs <- seq(0, 1, length.out = 5 + 1) niveau <- cut(niveau, breaks=quantile(niveau, probs, na.rm = TRUE, names = FALSE), labels=paste('level', 0:4), include.lowest = TRUE) niveau <- as.character(niveau) niveau <- factor(niveau, labels=) paste0("<strong>Bezirk: </strong>", as.character( test_polygons@data $ID), "<br><strong><br>", "</strong>", "<strong>Level: </strong>", niveau ) } tiles <- "http://{s}.tile.stamen.com/toner-lite/{z}/{x}/{y}.png" attribution <- 'Map tiles by <a target="_blank" href="http://stamen.com">Stamen Design</a>, under <a target="_blank" href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Map data by <a target="_blank" href="http://www.naturalearthdata.com/">Natural Earth</a>.' # produce the leaflet map ==== pal <- colorQuantile("YlOrRd", NULL, n = 5) m.sample <- leaflet(data = test_polygons) %>% addTiles(urlTemplate = tiles, attribution = attribution) %>% setView(13.782778, 47.61, zoom = 7) %>% addPolygons(fillColor = ~pal(test_polygons$sample), fillOpacity = 0.8, color = "#000000", weight = 1, popup = world_popup('sample')) # start the server part server <- function(input, output, session) { output$query <- renderText({ as.character(parseQueryString(session$clientData$url_search)) }) output$mymap <- renderLeaflet({ m.sample }) } 

ui.R

Although the user interface is pretty simple:

 require(leaflet) require(shiny) ui <- fluidPage( column(width=12, leafletOutput("mymap", height="200px")#, height="700px") ) ) 

This works well on my desktop computer. However, as soon as I try to access it on my server, the booklet map loads terribly slowly. Especially if I change the height, say, by 100%, it generally stops loading. So here are my questions:

  • How to speed up the boot process.
  • Is it possible to download some details in advance, since everything reacts in this context.
  • Can I create a card that does not depend on brilliance - perhaps this download will be faster.
  • Is it possible that my polygons have a lot of details?

Thank you very much for your help!

+6
source share
1 answer

Based on comments simplifying the SP-Object, I did the trick. I imported the base shapefile into QGis and adjusted it with

  Vector => Geometry Tools => Simplify geometries 

Now it works much faster. More information can be found at:

Qgis-Stackexchange or Documentation .

Thank you for your help!

+2
source

All Articles