Closed pietervreeburg closed 1 year ago
Hello @pietervreeburg , This happens because tiles are cached using a combination of the query params as filenames (nlmaps_13_4196_2709.png => src_zoom_xindex_yindex.extension). To solve your problem you just have to use a different "src" name for the second source.
library(maptiles)
nlmaps1 <- list(
src = "nlmaps_standaard",
q = "https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0/{s}/EPSG:3857/{z}/{x}/{y}.png",
sub = "standaard",
cit = "Kadaster")
bedr_tiles <- get_tiles(bedr_terreinen,
nlmaps1,
forceDownload = TRUE,
verbose = TRUE)
plot_tiles(bedr_tiles)
nlmaps2 <- list(
src = "nlmaps_grijs",
q = "https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0/{s}/EPSG:3857/{z}/{x}/{y}.png",
sub = "grijs",
cit = "Kadaster")
bedr_tiles <- get_tiles(bedr_terreinen,
nlmaps2,
forceDownload = TRUE,
verbose = TRUE)
plot_tiles(bedr_tiles)
I could add the "sub" value in the filenames of the cached tiles but for most tiles providers the sub value is not relevant information. They provide the same tiles on various subdomains (e.g. a, b, c) and maptiles
uses these subdomains (randomly) to send distributed queries to the server.
Thanks for your reply. This indeed solved my problem. Happily making maps for my colleagues now.
Regards,
Pieter
When I download a set of tiles using the maptiles package everything works fine the first time. When I download a variant of the same tileset the files in my cachefile get updated, but plot_tiles still uses the first set of tiles.
plot_tiles only shows the new files when physically remove the cached files and redownload the tileset variant or restart my R session.
Code to reproduce the issue below: