Render custom tiles in R leaflet from local directory (i.e. not from a git repository)

Viewed 1423

I have created some tiles out of a very large raster using the Qtiles plugin in Qgis. I have saved them to a local directory on my computer, and now want to render them in a leaflet map using R.

The addTiles function passes a URL, but doesn't seem to work with a local filepath. In a different post (How to render custom map tiles created with gdal2tiles in Leaflet for R?), Lauren recommends using a www folder inside the shiny directory. Firstly, I'm not 100% sure what is meant by that, and secondly I don't know if that solution is applicable to what I'm trying to do; all I want to do is render these tiles in a leaflet map object and save it locally as html. Is it possible to do what I am attempting?

The code looks something like this:

library(leaflet)

map <- leaflet()

map <- addProviderTiles(map, "CartoDB.Positron")

map <- addTiles(map, "C:/mapTiles/level100Tiles/{z}/{x}/{y}.png")

Is there a different leaflet function for this specific purpose that I am not aware of? Or is it just not something that's done?

Thanks :)

1 Answers
Related