[R] Cannot view custom tiles made in package tiler in r leaflet - either locally or from github pages server.

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Thu Feb 6 13:10:19 CET 2020


Shouldn't you be posting this on the r-sig-geo list, not here?

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Feb 5, 2020 at 10:38 PM nevil amos <nevil.amos using gmail.com> wrote:

> I wish to create tiled version of a large number of custom rasters for
> viewing in shiny/leaflet apps ( to speed viewing of rasters)
>
> I have produced tiles using  package tiler, these can be viewed in the
> preview.html, but when uploaded to github pages  as described in the
> introduction to tiler they do not show up when added as tiles in leaflet.
>
> It is difficult to make a reproducible code here - since the tiles have to
> be loaded to be served from the web.
>
> However below I include the code used 1. to produce the tiles and 2, to
> view the tiles in my github pages.
>
> I have tried the suggestion of using {-y} in the sever path for TMS, this
> makes no difference the background map is displayed but the custom tiles
> are not.
>
> Raster used from the package as an example in reality I need to serve many
> 10000x6000 cell geotiffs.
>
> Example code:
>
> library(tiler)
> libary(leaflet)
> # make tiles in zoom levels 1:6 these tiles have then been uploaded to
> github to serve from repository:
> #
>
> tile_dir<-"us48lr"
> map <- system.file("maps/map_wgs84.tif", package = "tiler")
> tile(map,tile_dir , "0-6")
> view_tiles(tile_dir)
>
>
> #no TMS related modifications
> tiles <- "https://nevilamos.github.io/TileTest/us48lr/{z}/{x}/{y}.png"
> leaflet(
>   options = leafletOptions(minZoom = 0, maxZoom = 7), width = "100%") %>%
>   addProviderTiles("Stamen.Toner") %>%
>   addTiles(urlTemplate=tiles, options = tileOptions(opacity = 0.8)) %>%
> setView(-100, 40, 3)
>
> #No tiles displayed
>
>
> # {-y} and tileOptions(tms=T)
> tiles <- "https://nevilamos.github.io/TileTest/us48lr/{z}/{x}/{-y}.png"
> leaflet(
>   options = leafletOptions(minZoom = 0, maxZoom = 7), width = "100%") %>%
>   addProviderTiles("Stamen.Toner") %>%
>   addTiles(urlTemplate=tiles, options = tileOptions(opacity = 0.8,tms=T))
> %>% setView(-100, 40, 3)
>
> #No tiles displayed
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list