riatelab / maptiles Goto Github PK
View Code? Open in Web Editor NEWDownload, compose and display map tiles with R
Download, compose and display map tiles with R
I noticed a small inconsistency with the leaflet providers:
library(maptiles)
library(leaflet)
a = names(maptiles:::maptiles_providers)
b = names(leaflet::providers)
a
#> [1] "OpenStreetMap" "OpenStreetMap.DE"
#> [3] "OpenStreetMap.France" "OpenStreetMap.HOT"
#> [5] "OpenTopoMap" "Stadia.Stamen.Toner"
#> [7] "Stadia.Stamen.TonerBackground" "Stadia.Stamen.TonerLines"
#> [9] "Stadia.Stamen.TonerLabels" "Stadia.Stamen.TonerLite"
#> [11] "Stadia.Stamen.Watercolor" "Stadia.Stamen.Terrain"
#> [13] "Stadia.Stamen.TerrainBackground" "Stadia.Stamen.TerrainLabels"
#> [15] "Esri.WorldStreetMap" "Esri.DeLorme"
#> [17] "Esri.WorldTopoMap" "Esri.WorldImagery"
#> [19] "Esri.WorldTerrain" "Esri.WorldShadedRelief"
#> [21] "Esri.OceanBasemap" "Esri.NatGeoWorldMap"
#> [23] "Esri.WorldGrayCanvas" "CartoDB.Positron"
#> [25] "CartoDB.PositronNoLabels" "CartoDB.PositronOnlyLabels"
#> [27] "CartoDB.DarkMatter" "CartoDB.DarkMatterNoLabels"
#> [29] "CartoDB.DarkMatterOnlyLabels" "CartoDB.Voyager"
#> [31] "CartoDB.VoyagerNoLabels" "CartoDB.VoyagerOnlyLabels"
#> [33] "Thunderforest.OpenCycleMap" "Thunderforest.Transport"
#> [35] "Thunderforest.TransportDark" "Thunderforest.SpinalMap"
#> [37] "Thunderforest.Landscape" "Thunderforest.Outdoors"
#> [39] "Thunderforest.Pioneer" "Thunderforest.MobileAtlas"
#> [41] "Thunderforest.Neighbourhood"
b
#> [1] "OpenStreetMap"
#> [2] "OpenStreetMap.Mapnik"
#> [3] "OpenStreetMap.DE"
#> [4] "OpenStreetMap.CH"
#> [5] "OpenStreetMap.France"
#> [6] "OpenStreetMap.HOT"
#> [7] "OpenStreetMap.BZH"
#> [8] "MapTilesAPI"
#> [9] "MapTilesAPI.OSMEnglish"
#> [10] "MapTilesAPI.OSMFrancais"
#> [11] "MapTilesAPI.OSMEspagnol"
#> [12] "OpenSeaMap"
#> [13] "OPNVKarte"
#> [14] "OpenTopoMap"
#> [15] "OpenRailwayMap"
#> [16] "OpenFireMap"
#> [17] "SafeCast"
#> [18] "Stadia"
#> [19] "Stadia.AlidadeSmooth"
#> [20] "Stadia.AlidadeSmoothDark"
#> [21] "Stadia.OSMBright"
#> [22] "Stadia.Outdoors"
#> [23] "Stadia.StamenToner"
#> [24] "Stadia.StamenTonerBackground"
#> [25] "Stadia.StamenTonerLines"
#> [26] "Stadia.StamenTonerLabels"
#> [27] "Stadia.StamenTonerLite"
#> [28] "Stadia.StamenWatercolor"
#> [29] "Stadia.StamenTerrain"
#> [30] "Stadia.StamenTerrainBackground"
#> [31] "Stadia.StamenTerrainLabels"
#> [32] "Stadia.StamenTerrainLines"
#> [33] "Thunderforest"
#> [34] "Thunderforest.OpenCycleMap"
#> [35] "Thunderforest.Transport"
#> [36] "Thunderforest.TransportDark"
#> [37] "Thunderforest.SpinalMap"
#> [38] "Thunderforest.Landscape"
#> [39] "Thunderforest.Outdoors"
#> [40] "Thunderforest.Pioneer"
#> [41] "Thunderforest.MobileAtlas"
#> [42] "Thunderforest.Neighbourhood"
#> [43] "CyclOSM"
#> [44] "Jawg"
#> [45] "Jawg.Streets"
#> [46] "Jawg.Terrain"
#> [47] "Jawg.Sunny"
#> [48] "Jawg.Dark"
#> [49] "Jawg.Light"
#> [50] "Jawg.Matrix"
#> [51] "MapBox"
#> [52] "MapTiler"
#> [53] "MapTiler.Streets"
#> [54] "MapTiler.Basic"
#> [55] "MapTiler.Bright"
#> [56] "MapTiler.Pastel"
#> [57] "MapTiler.Positron"
#> [58] "MapTiler.Hybrid"
#> [59] "MapTiler.Toner"
#> [60] "MapTiler.Topo"
#> [61] "MapTiler.Voyager"
#> [62] "TomTom"
#> [63] "TomTom.Basic"
#> [64] "TomTom.Hybrid"
#> [65] "TomTom.Labels"
#> [66] "Esri"
#> [67] "Esri.WorldStreetMap"
#> [68] "Esri.DeLorme"
#> [69] "Esri.WorldTopoMap"
#> [70] "Esri.WorldImagery"
#> [71] "Esri.WorldTerrain"
#> [72] "Esri.WorldShadedRelief"
#> [73] "Esri.WorldPhysical"
#> [74] "Esri.OceanBasemap"
#> [75] "Esri.NatGeoWorldMap"
#> [76] "Esri.WorldGrayCanvas"
#> [77] "OpenWeatherMap"
#> [78] "OpenWeatherMap.Clouds"
#> [79] "OpenWeatherMap.CloudsClassic"
#> [80] "OpenWeatherMap.Precipitation"
#> [81] "OpenWeatherMap.PrecipitationClassic"
#> [82] "OpenWeatherMap.Rain"
#> [83] "OpenWeatherMap.RainClassic"
#> [84] "OpenWeatherMap.Pressure"
#> [85] "OpenWeatherMap.PressureContour"
#> [86] "OpenWeatherMap.Wind"
#> [87] "OpenWeatherMap.Temperature"
#> [88] "OpenWeatherMap.Snow"
#> [89] "HERE"
#> [90] "HERE.normalDay"
#> [91] "HERE.normalDayCustom"
#> [92] "HERE.normalDayGrey"
#> [93] "HERE.normalDayMobile"
#> [94] "HERE.normalDayGreyMobile"
#> [95] "HERE.normalDayTransit"
#> [96] "HERE.normalDayTransitMobile"
#> [97] "HERE.normalDayTraffic"
#> [98] "HERE.normalNight"
#> [99] "HERE.normalNightMobile"
#> [100] "HERE.normalNightGrey"
#> [101] "HERE.normalNightGreyMobile"
#> [102] "HERE.normalNightTransit"
#> [103] "HERE.normalNightTransitMobile"
#> [104] "HERE.reducedDay"
#> [105] "HERE.reducedNight"
#> [106] "HERE.basicMap"
#> [107] "HERE.mapLabels"
#> [108] "HERE.trafficFlow"
#> [109] "HERE.carnavDayGrey"
#> [110] "HERE.hybridDay"
#> [111] "HERE.hybridDayMobile"
#> [112] "HERE.hybridDayTransit"
#> [113] "HERE.hybridDayGrey"
#> [114] "HERE.hybridDayTraffic"
#> [115] "HERE.pedestrianDay"
#> [116] "HERE.pedestrianNight"
#> [117] "HERE.satelliteDay"
#> [118] "HERE.terrainDay"
#> [119] "HERE.terrainDayMobile"
#> [120] "HEREv3"
#> [121] "HEREv3.normalDay"
#> [122] "HEREv3.normalDayCustom"
#> [123] "HEREv3.normalDayGrey"
#> [124] "HEREv3.normalDayMobile"
#> [125] "HEREv3.normalDayGreyMobile"
#> [126] "HEREv3.normalDayTransit"
#> [127] "HEREv3.normalDayTransitMobile"
#> [128] "HEREv3.normalNight"
#> [129] "HEREv3.normalNightMobile"
#> [130] "HEREv3.normalNightGrey"
#> [131] "HEREv3.normalNightGreyMobile"
#> [132] "HEREv3.normalNightTransit"
#> [133] "HEREv3.normalNightTransitMobile"
#> [134] "HEREv3.reducedDay"
#> [135] "HEREv3.reducedNight"
#> [136] "HEREv3.basicMap"
#> [137] "HEREv3.mapLabels"
#> [138] "HEREv3.trafficFlow"
#> [139] "HEREv3.carnavDayGrey"
#> [140] "HEREv3.hybridDay"
#> [141] "HEREv3.hybridDayMobile"
#> [142] "HEREv3.hybridDayTransit"
#> [143] "HEREv3.hybridDayGrey"
#> [144] "HEREv3.pedestrianDay"
#> [145] "HEREv3.pedestrianNight"
#> [146] "HEREv3.satelliteDay"
#> [147] "HEREv3.terrainDay"
#> [148] "HEREv3.terrainDayMobile"
#> [149] "FreeMapSK"
#> [150] "MtbMap"
#> [151] "CartoDB"
#> [152] "CartoDB.Positron"
#> [153] "CartoDB.PositronNoLabels"
#> [154] "CartoDB.PositronOnlyLabels"
#> [155] "CartoDB.DarkMatter"
#> [156] "CartoDB.DarkMatterNoLabels"
#> [157] "CartoDB.DarkMatterOnlyLabels"
#> [158] "CartoDB.Voyager"
#> [159] "CartoDB.VoyagerNoLabels"
#> [160] "CartoDB.VoyagerOnlyLabels"
#> [161] "CartoDB.VoyagerLabelsUnder"
#> [162] "HikeBike"
#> [163] "HikeBike.HikeBike"
#> [164] "HikeBike.HillShading"
#> [165] "BasemapAT"
#> [166] "BasemapAT.basemap"
#> [167] "BasemapAT.grau"
#> [168] "BasemapAT.overlay"
#> [169] "BasemapAT.terrain"
#> [170] "BasemapAT.surface"
#> [171] "BasemapAT.highdpi"
#> [172] "BasemapAT.orthofoto"
#> [173] "nlmaps"
#> [174] "nlmaps.standaard"
#> [175] "nlmaps.pastel"
#> [176] "nlmaps.grijs"
#> [177] "nlmaps.water"
#> [178] "nlmaps.luchtfoto"
#> [179] "NASAGIBS"
#> [180] "NASAGIBS.ModisTerraTrueColorCR"
#> [181] "NASAGIBS.ModisTerraBands367CR"
#> [182] "NASAGIBS.ViirsEarthAtNight2012"
#> [183] "NASAGIBS.ModisTerraLSTDay"
#> [184] "NASAGIBS.ModisTerraSnowCover"
#> [185] "NASAGIBS.ModisTerraAOD"
#> [186] "NASAGIBS.ModisTerraChlorophyll"
#> [187] "NLS"
#> [188] "JusticeMap"
#> [189] "JusticeMap.income"
#> [190] "JusticeMap.americanIndian"
#> [191] "JusticeMap.asian"
#> [192] "JusticeMap.black"
#> [193] "JusticeMap.hispanic"
#> [194] "JusticeMap.multi"
#> [195] "JusticeMap.nonWhite"
#> [196] "JusticeMap.white"
#> [197] "JusticeMap.plurality"
#> [198] "GeoportailFrance"
#> [199] "GeoportailFrance.plan"
#> [200] "GeoportailFrance.parcels"
#> [201] "GeoportailFrance.orthos"
#> [202] "OneMapSG"
#> [203] "OneMapSG.Default"
#> [204] "OneMapSG.Night"
#> [205] "OneMapSG.Original"
#> [206] "OneMapSG.Grey"
#> [207] "OneMapSG.LandLot"
#> [208] "USGS"
#> [209] "USGS.USTopo"
#> [210] "USGS.USImagery"
#> [211] "USGS.USImageryTopo"
#> [212] "WaymarkedTrails"
#> [213] "WaymarkedTrails.hiking"
#> [214] "WaymarkedTrails.cycling"
#> [215] "WaymarkedTrails.mtb"
#> [216] "WaymarkedTrails.slopes"
#> [217] "WaymarkedTrails.riding"
#> [218] "WaymarkedTrails.skating"
#> [219] "OpenAIP"
#> [220] "OpenSnowMap"
#> [221] "OpenSnowMap.pistes"
#> [222] "AzureMaps"
#> [223] "AzureMaps.MicrosoftImagery"
#> [224] "AzureMaps.MicrosoftBaseDarkGrey"
#> [225] "AzureMaps.MicrosoftBaseRoad"
#> [226] "AzureMaps.MicrosoftBaseHybridRoad"
#> [227] "AzureMaps.MicrosoftTerraMain"
#> [228] "AzureMaps.MicrosoftWeatherInfraredMain"
#> [229] "AzureMaps.MicrosoftWeatherRadarMain"
#> [230] "SwissFederalGeoportal"
#> [231] "SwissFederalGeoportal.NationalMapColor"
#> [232] "SwissFederalGeoportal.NationalMapGrey"
#> [233] "SwissFederalGeoportal.SWISSIMAGE"
setdiff(a, b)
#> [1] "Stadia.Stamen.Toner" "Stadia.Stamen.TonerBackground"
#> [3] "Stadia.Stamen.TonerLines" "Stadia.Stamen.TonerLabels"
#> [5] "Stadia.Stamen.TonerLite" "Stadia.Stamen.Watercolor"
#> [7] "Stadia.Stamen.Terrain" "Stadia.Stamen.TerrainBackground"
#> [9] "Stadia.Stamen.TerrainLabels"
Created on 2024-01-15 with reprex v2.0.2
The 'Stadia' names in maptiles have a second dot. Can you remove those?
If not, is the list of maptiles provided exported somewhere? No I have to make use of the :::
operator.
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:
library(tidyverse)
library(sf)
library(httr)
zh_wfs <- "https://geodata.zuid-holland.nl/geoserver/economie/wfs?version=2.0.0"
url <- parse_url(zh_wfs)
url$query <- list(service = "WFS",
version = "2.0.0",
request = "GetFeature",
typename = "economie:BEDRIJVEN_TERREINEN",
outputFormat = "application/json")
request <- build_url(url)
request
bedr_terreinen <- st_read(request)
bedr_terreinen <- bedr_terreinen %>%
filter(terreinbeheerder == "SCHIEDAM")
bedr_terreinen <- st_transform(bedr_terreinen, 3857)
bedr_terreinen <- st_make_valid(bedr_terreinen)
library(maptiles)
nlmaps <- list(
src = "nlmaps",
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,
nlmaps,
forceDownload = TRUE,
verbose = TRUE)
plot_tiles(bedr_tiles)
library(maptiles)
nlmaps <- list(
src = "nlmaps",
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,
nlmaps,
forceDownload = TRUE,
verbose = TRUE)
plot_tiles(bedr_tiles)
Hi,
maptiles
.xyz
address: http://<IP_address>:8088/data/nycblg/{z}/{x}/{y}.pbf
maptiles
. It fails with an error.Here is my code:
# Define provider
tlsplc <- maptiles::create_provider(name = "nycplc", url = "http://<ip_address>:8088/data/nycplc/{z}/{x}/{y}.pbf", citation = "kuq, 2024")
# Create extent from shapefile (counties)
nysshp <- sf::st_read("gis/county.shp", quiet = TRUE)
# Draw vector tiles
nycplc <- maptiles::get_tiles(x = nysshp, provider = tlsplc, crop = FALSE, zoom = 12, project = FALSE, verbose = TRUE)
The error I get is:
Zoom: 12
Source(s): kuq, 2024
Cache directory: /tmp/RtmpXX5urU/nycplc
Error in as.vector(x, "character") : cannot coerce type 'closure' to vector of type 'character'
What am I missing here?
S.
I have no clue why: maybe the OS, the graphics device, ...
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────
hash: person playing handball: medium-light skin tone, breast-feeding: light skin tone, flag: Curaçao
setting value
version R version 4.1.2 (2021-11-01)
os Ubuntu 20.04.4 LTS
system x86_64, linux-gnu
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz Europe/Amsterdam
date 2022-03-01
rstudio 1.4.1714 Juliet Rose (desktop)
pandoc NA
Hello,
I tried running the example for the get_tiles function, and I'm getting the following error when calling get_tiles
on lines 4 and 15:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘crs’ for signature ‘"character"’
library(sf)
library(maptiles)
nc <- st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE)
nc_osm <- get_tiles(nc, crop = TRUE, zoom = 6)
plot_tiles(nc_osm)
# Download tiles from OSM, no labels
osm <- list(
src = 'OSM',
q = '"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"',
sub = c('a','b', 'c'),
cit = '© OpenStreetMap contributors.'
)
# dowload tiles and compose raster (SpatRaster)
nc_osm2 <- get_tiles(x = nc, provider = osm, crop = TRUE,
zoom = 6, verbose = TRUE)
# Plot the tiles
plot_tiles(nc_osm2)
I'm running on windows and tried updating the packages - though I haven't updated all dependencies. It feels like it's probably a local environment issue, but I'm not sure how to approach problem solving. Any recommendations?
I am trying to download tiles from a new basemap generate for New Zealand (https://basemaps.linz.govt.nz/) but the tiles are in the .webp format rather than jpg or png format.
prov <- maptiles::create_provider(name = "LINZ",
url = paste0("https://basemaps.linz.govt.nz/v1/tiles/aerial/WebMercatorQuad/{z}/{x}/{y}.webp?api=", apikey),
citation = "LINZ")
tiles <- maptiles::get_tiles(x = shape, provider = prov, zoom = zoom,
verbose = verbose)
# Error in as.vector(x, "character") :
# cannot coerce type 'closure' to vector of type 'character'
Hello
add these 2 lines
Sys.setenv(http_proxy = "xxxxxxxxx:yyyy")
Sys.setenv(https_proxy = "xxxxxxxxx:yyyy")
to cross the proxy of your company
library(mapsf)
library(maptiles)
Sys.setenv(http_proxy = "xxxxxxxxx:yyyy")
Sys.setenv(https_proxy = "xxxxxxxxx:yyyy")
mtq <- mapsf::mf_get_mtq()
mtq_wgs84 <- st_transform(mtq, crs = 4326)
mtq_bb <- st_bbox(mtq_wgs84)
mtqOSM <- maptiles::get_tiles(x = mtq_bb, provider = "OpenStreetMap", zoom = 11,
crop = TRUE)
mf_raster(mtqOSM)
mf_base(mtq_wgs84, col = NA, lwd = 1 , add = TRUE)
mtqOSM1 <- maptiles::get_tiles(x = mtq_bb, provider = "Stamen.Terrain", zoom = 10,
crop = TRUE)
mf_raster(mtqOSM1)
mf_base(mtq_wgs84, col = NA, lwd = 1 , add = TRUE)
osm <- list(
src = 'OSM',
q = '"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"', <= HEre " ' server name ' "
sub = c('a','b', 'c'),
cit = '© OpenStreetMap contributors.'
)
It would by to have allow argument x
in get_tiles
to be a SpatExtent
. You could do something like this:
if (inherits(x, "SpatExtent")) {
bbx <- as.vector(e)[c(1,3,2,4)]
} else {
I would prefer that over a SpatRaster
argument, but you could do something like this
} else if (inherits(x, "SpatRaster")) {
p <- as.polygons(ext(x), crs=crs(x))
y <- project(p, "epsg:4326")
bbx <- as.vector(ext(y))[c(1,3,2,4)]
The images are fuzzy, compared to OpenStreetMap (to be taken off CRAN next week). I guess it uses a different tile fetching mechanism, because at a particular zoom level, the images have better resolution.
This may be related to #5, but I don't think so, as the downloaded tiles in the cache folder have the same fuzzyness.
Is it worth looking into how Ian's code does this? It does look a lot nicer in larger images.
rosm
has the same resolution, by the way.
Here is the comparison:
And here's the code generating it:
d <- read.table(sep=",", header=TRUE, text=
"lat, long
52.514464, 13.350137
52.370000, 13.120000
55.685143, 12.580008
50.106452, 14.419989
48.847003, 2.3372130
51.505364,-0.1647520")
png("maps%d.png", width=2, height=2, units="in", res=200)
# OpenStreetMap ----
OSMscale::pointsMap(lat, long, data=d, fx=0, scale=FALSE, pch=NA, zoom=5)
title(main="OpenStreetMap", line=-1)
# maptiles ----
bounds <- sf::st_bbox(sf::st_as_sf(d, coords=c("long", "lat"), crs=4326))
map <- maptiles::get_tiles(bounds, crop=TRUE, zoom=5, project=FALSE)
maptiles::plot_tiles(map, adjust=FALSE)
title(main="maptiles", line=-1)
dev.off()
I was unsure if maintainers of the package receive notifications about new comments on closed issues, so I opened a new one. Feel free to close it if this is not how it should be done. Cheers.
Additionally, here a working example with an interactive tmap (requires dev-version):
remotes::install_github('r-tmap/tmap')
library(tmap)
library(leaflet)
epsg28992 <- leafletCRS(
crsClass = "L.Proj.CRS"
,code = "EPSG:28992"
,proj4def = "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs"
,origin=c(-285401.92,903401.92)
,resolutions = c(3251.206502413005,1625.6032512065026,812.8016256032513,406.40081280162565,203.20040640081282,101.60020320040641, 50.800101600203206,25.400050800101603,12.700025400050801,6.350012700025401,3.1750063500127004,1.5875031750063502,0.7937515875031751,0.39687579375158755,0.19843789687579377,0.09921894843789689,0.04960947421894844)
)
url <- "https://geodata.nationaalgeoregister.nl/tiles/service/wmts/opentopo/EPSG:28992/{z}/{x}/{y}.jpeg"
data(World)
tmap_mode("view")
tm_shape(World) +
tm_polygons() +
tm_basemap(NULL) +
tm_view(projection = epsg28992, set.view = c(5.092098,52.093992,4)) +
tm_tiles(server = url) +
tm_mouse_coordinates()
Originally posted by @gremms1 in #13 (comment)
I've noticed that it's possible to use WMTS with maptiles but this requires you to build a specific URL.
It's probably not necessary to implement a new function like wmts_server_adress
below inside maptiles
(or maybe yes?) but perhaps it would be interesting to complete the function examples (let me know if I should prepare a pull request).
Also, I'm using sub
argument to choose the layer name but I don't know if it's the right way. Perhaps, specify the layer name directly inside wmts_server_adress
is better,
library(happign)
library(maptiles)
# get features from France
x <- get_apicarto_cadastre("29158", "commune")
# build wmts server adress
wmts_server_adress <- function(path,
tilematrixset,
format = "image/jpeg",
version="1.0.0",
style = "normal"){
server_adress = paste0("https://", path, "?",
"&REQUEST=GetTile",
"&SERVICE=WMTS",
"&VERSION=",version,
"&STYLE=", style,
"&TILEMATRIXSET=", tilematrixset,
"&FORMAT=", format,
"&LAYER={s}",
"&TILEMATRIX={z}",
"&TILEROW={y}",
"&TILECOL={x}")
return(server_adress)
}
# query tiles
tiles <- get_tiles(x,
provider = list(src = "IGN.ortho",
q = wmts_server_adress("wxs.ign.fr/ortho/geoportail/wmts","PM"),
sub = "ORTHOIMAGERY.ORTHOPHOTOS.IRC",
cit = "© IGN BD ORTHO"),
zoom = 15)
plot_tiles(tiles)
Created on 2023-08-15 with reprex v2.0.2
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.3.0 (2023-04-21 ucrt)
#> os Windows 10 x64 (build 19045)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate French_France.utf8
#> ctype French_France.utf8
#> tz Europe/Paris
#> date 2023-08-15
#> pandoc 3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> ! package * version date (UTC) lib source
#> D archive 1.1.5 2022-05-06 [1] CRAN (R 4.3.0)
#> class 7.3-21 2023-01-23 [2] CRAN (R 4.3.0)
#> classInt 0.4-9 2023-02-28 [1] CRAN (R 4.3.0)
#> cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.0)
#> codetools 0.2-19 2023-02-01 [2] CRAN (R 4.3.0)
#> curl 5.0.1 2023-06-07 [1] CRAN (R 4.3.1)
#> DBI 1.1.3 2022-06-18 [1] CRAN (R 4.3.0)
#> digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.1)
#> dplyr 1.1.2 2023-04-20 [1] CRAN (R 4.3.0)
#> e1071 1.7-13 2023-02-01 [1] CRAN (R 4.3.0)
#> evaluate 0.21 2023-05-05 [1] CRAN (R 4.3.0)
#> fansi 1.0.4 2023-01-22 [1] CRAN (R 4.3.0)
#> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0)
#> fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.1)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.3.0)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.3.0)
#> happign * 0.2.0 2023-08-07 [1] Github (paul-carteron/happign@f0e87d2)
#> highr 0.10 2022-12-22 [1] CRAN (R 4.3.0)
#> htmltools 0.5.5 2023-03-23 [1] CRAN (R 4.3.0)
#> httr2 0.2.3 2023-05-08 [1] CRAN (R 4.3.0)
#> jsonlite 1.8.7 2023-06-29 [1] CRAN (R 4.3.1)
#> KernSmooth 2.23-20 2021-05-03 [2] CRAN (R 4.3.0)
#> knitr 1.43 2023-05-25 [1] CRAN (R 4.3.0)
#> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.3.0)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0)
#> maptiles * 0.5.0 2023-04-04 [1] CRAN (R 4.3.1)
#> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.0)
#> proxy 0.4-27 2022-06-09 [1] CRAN (R 4.3.0)
#> purrr 1.0.1 2023-01-10 [1] CRAN (R 4.3.0)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.0)
#> rappdirs 0.3.3 2021-01-31 [1] CRAN (R 4.3.0)
#> Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.3.1)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.3.1)
#> rlang 1.1.1 2023-04-28 [1] CRAN (R 4.3.0)
#> rmarkdown 2.23 2023-07-01 [1] CRAN (R 4.3.0)
#> rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.1)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)
#> sf 1.0-14 2023-07-11 [1] CRAN (R 4.3.1)
#> slippymath 0.3.1 2019-06-28 [1] CRAN (R 4.3.1)
#> terra 1.7-39 2023-06-23 [1] CRAN (R 4.3.1)
#> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.0)
#> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.3.0)
#> units 0.8-2 2023-04-27 [1] CRAN (R 4.3.0)
#> utf8 1.2.3 2023-01-31 [1] CRAN (R 4.3.0)
#> vctrs 0.6.3 2023-06-14 [1] CRAN (R 4.3.1)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.3.0)
#> xfun 0.39 2023-04-20 [1] CRAN (R 4.3.0)
#> xml2 1.3.5 2023-07-06 [1] CRAN (R 4.3.1)
#> yaml 2.3.7 2023-01-23 [1] CRAN (R 4.3.0)
#>
#> [1] C:/Users/PAUL/AppData/Local/R/win-library/4.3
#> [2] C:/Program Files/R/R-4.3.0/library
#>
#> D ── DLL MD5 mismatch, broken installation.
#>
#> ──────────────────────────────────────────────────────────────────────────────
hi
at work I can't use maptiles, while at home, there is no problem
I always have the error while with ggmap I have no problem
Error in curl::curl_download(url = q, destfile = outfile) :
Timeout was reached: [] Connection timed out after 10009 milliseconds
I have indicated the proxy with
library(httr)
set_config(.........)
For maptiles at work, is it the proxy ? And how to fix it?
Thank you for your help
In get_param()
search for env variables "STADIA_MAPS" for stadia maps or "THUNDERFOREST_MAPS" for thunderforest.
Add a flag to the param list.
Retrieve API key with Sys.getenv("THUNDERFOREST_MAPS")
only just before download in download_tiles()
.
Add doc, amend README
Hello,
I am trying to get the following code to work, but it's not working out:
library(sf)
library(maptiles)
p = st_point(c(110784.2,494605.3))
p = st_sfc(p)
p = st_set_crs(p, 28992)
bb = st_bbox(st_buffer(p, 300))
url <- "https://geodata.nationaalgeoregister.nl/tiles/service/wmts/opentopo/EPSG:28992/{z}/{x}/{y}.png"
mffp <- list(src="OpenTopo", q=url, sub=NA, cit='')
t <- get_tiles(bb, provider=mffp, crop= T, forceDownload = T, zoom=5)
I get the following error: Error in png::readPNG(img) : file is not in PNG format
The strange this is that entering the following url in my browser does yield the correct tile:
https://geodata.nationaalgeoregister.nl/tiles/service/wmts/opentopo/EPSG:28992/5/16/12.png
So the error that it throws me seems strange.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.