diff --git a/NEWS.md b/NEWS.md index 09753d2..0f66a57 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# ceramic dev + +* Added a suite of Tasmap sources for 'cc_location()'. + # ceramic 0.8.0 diff --git a/R/gdal.R b/R/gdal.R index 947d358..f45ee06 100644 --- a/R/gdal.R +++ b/R/gdal.R @@ -188,15 +188,16 @@ gdal_terrainrgb <- function (extent = c(-180, 180, -90, 90), ..., dimension = NU gdal_tasmap <- function (extent = c(-180, 180, -90, 90), ..., dimension = NULL, - projection = "OGC:CRS84", resample = "near", source = NULL) + projection = "OGC:CRS84", resample = "near", source = NULL, type = "tasmap") { xraster <- extent x <- format_out(list(extent = extent, dimension = dimension, projection = projection)) - - src <- tasmap_ortho + if (type == "tasmap") type <- "orthophoto" + + src <- tasmap_sources[type] if (is.null(source)) { diff --git a/R/locale.R b/R/locale.R index 839ce05..70658e1 100644 --- a/R/locale.R +++ b/R/locale.R @@ -11,12 +11,13 @@ #' `cc_elevation` does extra work to unpack the DEM tiles from the RGB format. #' #' Available types are 'elevation-tiles-prod' for AWS elevation tiles, and 'mapbox.satellite', -#' and 'mapbox.terrain-rgb'. +#' and 'mapbox.terrain-rgb', 'tasmap' or one of 'tasmap_street' (TTSA), 'tasmap_aerialphoto2020', 'tasmap_aerialphoto2021', 'tasmap_aerialphoto2022', +#' 'tasmap_aerialphoto2023', 'tasmap_esgismapbookpublic', 'tasmap_hillshadegrey', 'tasmap_hillshade', 'tasmap_orthophoto', +#' 'tasmap_simplebasemap', 'tasmap_tasmap100k', 'tasmap_tasmap250k', 'tasmap_tasmap25k', 'tasmap_tasmap500k', 'tasmap_tasmapraster', 'tasmap_topographicgrayscale', 'tasmap_topographic'. #' #' Note that arguments `max_tiles` and `zoom` are mutually exclusive. One or both must be `NULL`. If #' both are NULL then `max_tiles = 16L`. #' -#' Currently must be considered in-development. #' #' @param loc a longitude, latitude pair of coordinates, or a spatial object #' @param buffer with in metres to extend around the location, ignored if 'loc' is a spatial object with extent @@ -61,11 +62,13 @@ cc_location <- function(loc = NULL, buffer = 5000, # return(invisible(NULL)) #} - d <- switch(type, - mapbox.satellite = gdal_mapbox(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857"), - "elevation-tiles-prod" = gdal_aws(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857"), - "mapbox.terrain-rgb" = gdal_terrainrgb(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857"), - "tasmap_ortho" = gdal_tasmap(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857")) + if (type == 'mapbox.satellite') d<- gdal_mapbox(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857") + if (type == "elevation-tiles-prod") d <- gdal_aws(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857") + if (type == "mapbox.terrain-rgb") d <- gdal_terrainrgb(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857") + if (grepl("tasmap", type)) { + if (type == "tasmap") type <- "tasmap_orthophoto" + d <- gdal_tasmap(extent = locdata[1:4], dimension = as.integer(locdata[5:6]), projection = "EPSG:3857", type = gsub("tasmap_", "", type)) + } d } diff --git a/R/tasmap.R b/R/tasmap.R index 99b5fc9..15ffb5f 100644 --- a/R/tasmap.R +++ b/R/tasmap.R @@ -1,11 +1,34 @@ -tasmap_layers <- tibble::tribble( - ~Name, ~ServiceUrl, - "TTSA", "https://services.thelist.tas.gov.au/arcgis/services/Raster/TTSA/MapServer/WMSServer?", - "ESgisMapBookPUBLIC", "https://services.thelist.tas.gov.au/arcgis/services/Basemaps/ESgisMapBookPUBLIC/MapServer/WMSServer", - "HillshadeGrey", "https://services.thelist.tas.gov.au/arcgis/services/Basemaps/HillshadeGrey/MapServer/WMSServer?", - "Tasmap250K", "https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Tasmap250K/MapServer/WMSServer?", - "Topographic","https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Topographic/MapServer/WMSServer?" -) +# tasmap_layers <- tibble::tribble( +# ~Name, ~ServiceUrl, +# "TTSA", "https://services.thelist.tas.gov.au/arcgis/services/Raster/TTSA/MapServer/WMSServer?", +# "ESgisMapBookPUBLIC", "https://services.thelist.tas.gov.au/arcgis/services/Basemaps/ESgisMapBookPUBLIC/MapServer/WMSServer", +# "HillshadeGrey", "https://services.thelist.tas.gov.au/arcgis/services/Basemaps/HillshadeGrey/MapServer/WMSServer?", +# "Tasmap250K", "https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Tasmap250K/MapServer/WMSServer?", +# "Topographic","https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Topographic/MapServer/WMSServer?" +# ) +# +## bases, gsub("/", "_", bases) +template <- "WMTS:https://services.thelist.tas.gov.au/arcgis/rest/services/%s/MapServer/WMTS/1.0.0/WMTSCapabilities.xml,layer=%s,tilematrixset=default028mm" +bases <- +c("Basemaps/AerialPhoto2020", "Basemaps/AerialPhoto2021", "Basemaps/AerialPhoto2022", + "Basemaps/AerialPhoto2023", "Basemaps/ESgisMapBookPUBLIC", "Basemaps/HillshadeGrey", + "Basemaps/Hillshade", "Basemaps/Orthophoto", "Basemaps/SimpleBasemap", + "Basemaps/Tasmap100K", "Basemaps/Tasmap250K", "Basemaps/Tasmap25K", + "Basemaps/Tasmap500K", "Basemaps/TasmapRaster", "Basemaps/TopographicGrayScale", + "Basemaps/Topographic") -tasmap_ortho <- "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Orthophoto/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data%20Boundaries&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454" +names <- unlist(lapply(strsplit(bases, "/"), "[", 2)) + +tasmap_sources <- sprintf(template, bases, gsub("/", "_", bases)) +names(tasmap_sources) <- tolower(names) +## bit more work needed +tasmap_sources <- c(tasmap_sources, street = "https://services.thelist.tas.gov.au/arcgis/rest/services/Raster/TTSA/MapServer/WMTS/1.0.0/WMTSCapabilities.xml") +# tasmap_sources <- c( +# ortho = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Orthophoto/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data%20Boundaries&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454", +# street = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Raster/TTSA/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data_Boundaries47811&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454" , +# mapbook = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/ESgisMapBookPUBLIC/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data_Boundaries47811&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454", +# hillshade = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/HillshadeGrey/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data_Boundaries47811&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454" , +# tasmap250 = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Tasmap250K/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data_Boundaries47811&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454" , +# topo = "WMS:https://services.thelist.tas.gov.au/arcgis/services/Basemaps/Topographic/MapServer/WmsServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Data%20Boundaries&SRS=EPSG:4326&BBOX=111.848916,-54.849439,159.145536,-7.800454", +# tasmap500 = "WMTS:https://services.thelist.tas.gov.au/arcgis/rest/services/Basemaps/Tasmap500K/MapServer/WMTS/1.0.0/WMTSCapabilities.xml,layer=Basemaps_Tasmap500K,tilematrixset=default028mm") diff --git a/README.Rmd b/README.Rmd index 8d6a90e..281ff84 100644 --- a/README.Rmd +++ b/README.Rmd @@ -28,6 +28,8 @@ options(warn = -1) The goal of ceramic is to obtain web map tiles. Use a spatial object to define the region of interest. + + ```{r extent1} library(ceramic) roi <- ext(100, 160, -50, 10) @@ -196,6 +198,35 @@ par(op) ``` +## Tasmap maps + + +```{r tasmap} +library(ceramic) +library(terra) +template <- rast(ext(527358, 527880, 5252204, 5252704), res = 2, crs = "EPSG:32755") +ortho <- cc_location(template, type = "tasmap_orthophoto") + +plot(ortho) + +plot(cc_location(template, type = "tasmap_street")) + +plot(cc_location(template, type = "tasmap_tasmapraster")) + +plot(cc_location(template, type = "tasmap_hillshade")) + +plot(cc_location(template, type = "tasmap_hillshadegrey")) +plot(cc_location(template, type = "tasmap_esgismapbookpublic")) ## nope +plot(cc_location(template, type = "tasmap_topographic")) + + +plot(cc_location(template, type = "tasmap_tasmap25k")) ## also 100k, 250k, 500k + +``` + + + + --- diff --git a/README.md b/README.md index 8086b7a..af08e93 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,67 @@ text(middle(tiles$xmin, tiles$xmax), middle(tiles$ymin, tiles$ymax), lab = sprin par(op) ``` +## Tasmap maps + +``` r +library(ceramic) +library(terra) +template <- rast(ext(527358, 527880, 5252204, 5252704), res = 2, crs = "EPSG:32755") +ortho <- cc_location(template, type = "tasmap_orthophoto") + +plot(ortho) +``` + + + +``` r + +plot(cc_location(template, type = "tasmap_street")) +``` + + + +``` r + +plot(cc_location(template, type = "tasmap_tasmapraster")) +``` + + + +``` r + +plot(cc_location(template, type = "tasmap_hillshade")) +``` + + + +``` r + +plot(cc_location(template, type = "tasmap_hillshadegrey")) +``` + + + +``` r +plot(cc_location(template, type = "tasmap_esgismapbookpublic")) ## nope +``` + + + +``` r +plot(cc_location(template, type = "tasmap_topographic")) +``` + + + +``` r + + +plot(cc_location(template, type = "tasmap_tasmap25k")) ## also 100k, 250k, 500k +``` + + + ------------------------------------------------------------------------ Please note that the ‘ceramic’ project is released with a [Contributor diff --git a/man/cc_location.Rd b/man/cc_location.Rd index 181b88d..f31c067 100644 --- a/man/cc_location.Rd +++ b/man/cc_location.Rd @@ -131,12 +131,12 @@ around the raw longitude and latitude in metres. If \code{loc} has an extent, th \code{cc_elevation} does extra work to unpack the DEM tiles from the RGB format. Available types are 'elevation-tiles-prod' for AWS elevation tiles, and 'mapbox.satellite', -and 'mapbox.terrain-rgb'. +and 'mapbox.terrain-rgb', 'tasmap' or one of 'tasmap_street' (TTSA), 'tasmap_aerialphoto2020', 'tasmap_aerialphoto2021', 'tasmap_aerialphoto2022', +'tasmap_aerialphoto2023', 'tasmap_esgismapbookpublic', 'tasmap_hillshadegrey', 'tasmap_hillshade', 'tasmap_orthophoto', +'tasmap_simplebasemap', 'tasmap_tasmap100k', 'tasmap_tasmap250k', 'tasmap_tasmap25k', 'tasmap_tasmap500k', 'tasmap_tasmapraster', 'tasmap_topographicgrayscale', 'tasmap_topographic'. Note that arguments \code{max_tiles} and \code{zoom} are mutually exclusive. One or both must be \code{NULL}. If both are NULL then \code{max_tiles = 16L}. - -Currently must be considered in-development. } \examples{ if (!is.null(get_api_key())) { diff --git a/man/figures/README-tasmap-1.jpeg b/man/figures/README-tasmap-1.jpeg new file mode 100644 index 0000000..fe929fa Binary files /dev/null and b/man/figures/README-tasmap-1.jpeg differ diff --git a/man/figures/README-tasmap-2.jpeg b/man/figures/README-tasmap-2.jpeg new file mode 100644 index 0000000..38e9cc7 Binary files /dev/null and b/man/figures/README-tasmap-2.jpeg differ diff --git a/man/figures/README-tasmap-3.jpeg b/man/figures/README-tasmap-3.jpeg new file mode 100644 index 0000000..c1fa4b4 Binary files /dev/null and b/man/figures/README-tasmap-3.jpeg differ diff --git a/man/figures/README-tasmap-4.jpeg b/man/figures/README-tasmap-4.jpeg new file mode 100644 index 0000000..c182e28 Binary files /dev/null and b/man/figures/README-tasmap-4.jpeg differ diff --git a/man/figures/README-tasmap-5.jpeg b/man/figures/README-tasmap-5.jpeg new file mode 100644 index 0000000..d8fa80b Binary files /dev/null and b/man/figures/README-tasmap-5.jpeg differ diff --git a/man/figures/README-tasmap-6.jpeg b/man/figures/README-tasmap-6.jpeg new file mode 100644 index 0000000..60d6c2a Binary files /dev/null and b/man/figures/README-tasmap-6.jpeg differ diff --git a/man/figures/README-tasmap-7.jpeg b/man/figures/README-tasmap-7.jpeg new file mode 100644 index 0000000..facf38a Binary files /dev/null and b/man/figures/README-tasmap-7.jpeg differ diff --git a/man/figures/README-tasmap-8.jpeg b/man/figures/README-tasmap-8.jpeg new file mode 100644 index 0000000..4696d2b Binary files /dev/null and b/man/figures/README-tasmap-8.jpeg differ