1

I obtianed a large rasterfile (.asc file), which I can import in R and plot on a leaflet map. Because the file is pretty big, it takes about 40 seconds before the rasterimage is plotted on the basemap. This in comparison to shapefiles, which are plotted almost instantly.

I am wondering if there is a way to have the rasterfile plotted on the basemap more quickly?

The code I use to plot the file on the map is the following:

r = raster("file.asc")
 leaflet() %>% addSearchOSM() %>% 
  addProviderTiles(providers$CartoDB.Positron,
                   options = providerTileOptions(noWrap = TRUE),
                   group = "kaart") %>%
  addRasterImage(r, opacity = 0.5)
2
  • Maybe this question is of interest: gis.stackexchange.com/questions/62292/…
    – Aurèle
    Commented Jul 2, 2018 at 8:35
  • 1
    Try converting that file to RDS format by using the function saveRDS(object,"filename.rds), Then loading it using readRDS("filename.rds). RDS file type gets easily executed in R, saves a lot of time. Commented Jul 2, 2018 at 10:52

0

Browse other questions tagged or ask your own question.