mdsumner / wmts

PLEASE IGNORE, use hypertidy/gdalio instead
4 stars 0 forks source link

using gdalwarp instead #5

Closed mdsumner closed 3 years ago

mdsumner commented 3 years ago

examples from readme


f <- "WMTS:https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/1.0.0/WMTSCapabilities.xml,layer=IMERG_Precipitation_Rate"
ex <- c(100, 180, -50, -10)

dm <- c(512, 256)
v <- vapour_warp_raster(f, bands = 1:3, extent = ex, 
                        wkt = vapour_srs_wkt("+proj=longlat"), 
                        dimension = dm)

library(raster)
r <- raster(extent(ex), nrows = dm[2], dm[1])
plotRGB(setValues(brick(r, r, r), matrix(unlist(v), ncol = 3)))
maps::map(add = TRUE, col = "white")

# 
# f <- "WMTS:https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/WMTS/1.0.0/WMTSCapabilities.xml,layer=USGSTopo"
# f <- "WMTS:https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/WMTS/1.0.0/WMTSCapabilities.xml,layer=USGSTopo,tilematrixset=default028mm"
# f <- "WMTS:https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/WMTS/1.0.0/WMTSCapabilities.xml,layer=USGSTopo,tilematrixset=GoogleMapsCompatible"
# r <- raster(extent(-81, -80, -33, -30), crs = "+proj=longlat", nrows = 512, ncols = 512)
# v <- vapour_warp_raster(f, bands = 1:3, extent = extent(r), 
#                          wkt = vapour_srs_wkt(projection(r)), 
#                          dimension = dim(r)[2:1])

# 
# r <- raster(extent(ex), nrows = dm[2], dm[1])
# plotRGB(setValues(brick(r, r, r), matrix(unlist(v), ncol = 3)))
# maps::map(add = TRUE, col = "white")
# 

r <- raster(raster::extent(146, 148, -43, -40.5), crs = "+proj=longlat", nrows = 512, ncols  = 512)
f <- "WMTS:https://services.thelist.tas.gov.au/arcgis/rest/services/Basemaps/Topographic/MapServer/WMTS/1.0.0/WMTSCapabilities.xml,layer=Basemaps_Topographic,tilematrixset=default028mm"
 v <- vapour_warp_raster(f, bands = 1:3, extent = extent(r), 
                         wkt = vapour_srs_wkt(projection(r)), 
                         dimension = dim(r)[2:1])

f <- "WMTS:https://services.thelist.tas.gov.au/arcgis/rest/services/Basemaps/Orthophoto/MapServer/WMTS/1.0.0/WMTSCapabilities.xml"
v <- vapour_warp_raster(f, bands = 1:3, extent = extent(r), 
                        wkt = vapour_srs_wkt(projection(r)), 
                        dimension = dim(r)[2:1])

plotRGB(setValues(brick(r, r, r), matrix(unlist(v), ncol = 3)))
maps::map(add = TRUE, col = "white")

f <- "WMTS:https://services.thelist.tas.gov.au/arcgis/rest/services/Basemaps/HillshadeGrey/MapServer/WMTS/1.0.0/WMTSCapabilities.xml"
v <- vapour_warp_raster(f, bands = 1:3, extent = extent(r), 
                        wkt = vapour_srs_wkt(projection(r)), 
                        dimension = dim(r)[2:1])

plotRGB(setValues(brick(r, r, r), matrix(unlist(v), ncol = 3)))
maps::map(add = TRUE, col = "white")
mdsumner commented 3 years ago

yes indeed