diff --git a/DESCRIPTION b/DESCRIPTION index 51e03dc..bff30b1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: whatarelief Title: Get topography elevation and online imagery data -Version: 0.0.1.9011 +Version: 0.0.1.9012 Authors@R: person("Michael D.","Sumner", role = c("aut", "cre"), email = "mdsumner@gmail.com") Description: Obtain elevation data, topography relief for any region on the Earth. Topography and bathymetry data is supported by default. Sensible defaults exist @@ -16,18 +16,20 @@ Description: Obtain elevation data, topography relief for any region on the Eart License: MIT + file LICENSE Encoding: UTF-8 LazyData: true -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.0 Imports: - spatial.datasources, + sds, readr, vapour (>= 0.9.3.9003) Suggests: terra, raster, knitr, - rmarkdown, - ximage + rmarkdown, + ximage, + testthat (>= 3.0.0) VignetteBuilder: knitr URL: https://github.com/hypertidy/whatarelief BugReports: https://github.com/hypertidy/whatarelief/issues -Remotes: hypertidy/ximage, hypertidy/vapour, hypertidy/spatial.datasources +Remotes: hypertidy/ximage, hypertidy/vapour, hypertidy/sds +Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE index 27039f8..b58fc72 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,14 +2,16 @@ export(coastline) export(elevation) -export(gebco) -export(gebco21) export(imagery) export(raad_source) export(satbox) export(streetmap) -importFrom(spatial.datasources,cop30) -importFrom(spatial.datasources,cop90) -importFrom(spatial.datasources,gebco) -importFrom(spatial.datasources,gebco21) +importFrom(grDevices,contourLines) +importFrom(grDevices,dev.cur) importFrom(graphics,lines) +importFrom(graphics,par) +importFrom(sds,cop30) +importFrom(sds,cop90) +importFrom(sds,wms_openstreetmap_tms) +importFrom(stats,na.omit) +importFrom(utils,head) diff --git a/NEWS.md b/NEWS.md index 450e734..da18f76 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,7 @@ # whatarelief dev - -* Now importing gebco and all source related functions from spatial.datasources. +* Now importing gebco and all source related functions from sds. * New internal helper function to plot an image with the output of vapour:::gdal_raster_data. diff --git a/R/000_dsn.R b/R/000_dsn.R index 0dbe8be..38d4cf4 100644 --- a/R/000_dsn.R +++ b/R/000_dsn.R @@ -1,32 +1,21 @@ -.imagery_sources <- c(wms_arcgis_mapserver_ESRI.WorldImagery_tms = spatial.datasources::wms_arcgis_mapserver_ESRI.WorldImagery_tms(), - wms_bluemarble_s3_tms = spatial.datasources::wms_bluemarble_s3_tms(), - wms_googlehybrid_tms = spatial.datasources::wms_googlehybrid_tms(), - wms_virtualearth = spatial.datasources::wms_virtualearth(), - wms_ESA_worldcover_2020_tms = spatial.datasources::wms_ESA_worldcover_2020_tms(), - wms_mapbox_satellite = spatial.datasources::wms_mapbox_satellite()) +.imagery_sources <- c(wms_arcgis_mapserver_ESRI.WorldImagery_tms = sds::wms_arcgis_mapserver_ESRI.WorldImagery_tms(), + wms_bluemarble_s3_tms = sds::wms_bluemarble_s3_tms(), + wms_googlehybrid_tms = sds::wms_googlehybrid_tms(), + wms_virtualearth = sds::wms_virtualearth(), + wms_ESA_worldcover_2020_tms = sds::wms_ESA_worldcover_2020_tms(), + wms_mapbox_satellite = sds::wms_mapbox_satellite()) -.elevation_sources <- c(wms_amazon_elevation = spatial.datasources::wms_amazon_elevation(), - wms_amazon_elevation = spatial.datasources::wms_amazon_elevation(), - gebco = spatial.datasources::gebco()) +.elevation_sources <- c(wms_amazon_elevation = sds::wms_amazon_elevation(), + wms_amazon_elevation = sds::wms_amazon_elevation(), + gebco = sds::gebco()) -.streemap_sources <- c(wms_openstreetmap_tms = spatial.datasources::wms_openstreetmap_tms(), - wms_openstreetmap_tms= spatial.datasources::wms_openstreetmap_tms(), - wms_virtualearth_street = spatial.datasources::wms_virtualearth_street(), - wms_arcgis_mapserver_tms = spatial.datasources::wms_arcgis_mapserver_tms()) +.streemap_sources <- c(wms_openstreetmap_tms = sds::wms_openstreetmap_tms(), + wms_openstreetmap_tms= sds::wms_openstreetmap_tms(), + wms_virtualearth_street = sds::wms_virtualearth_street(), + wms_arcgis_mapserver_tms = sds::wms_arcgis_mapserver_tms()) - - -#' @importFrom spatial.datasources gebco -#' @export -#' @name gebco -"gebco" - -#' @importFrom spatial.datasources gebco21 -#' @export -#' @name gebco21 -"gebco21" diff --git a/R/coastline.R b/R/coastline.R index 3eac821..836a09d 100644 --- a/R/coastline.R +++ b/R/coastline.R @@ -15,7 +15,9 @@ #' #' @return matrix of coordinates in longlat (or whatever projection is specified) #' @export -#' +#' @importFrom grDevices contourLines dev.cur +#' @importFrom graphics par +#' @importFrom utils head #' @examples #' plot(coastline(extent = c(-180, 180, -90, 90)), type = "l") #' diff --git a/R/elevation.R b/R/elevation.R index ec9be1a..9ec21a9 100644 --- a/R/elevation.R +++ b/R/elevation.R @@ -77,7 +77,7 @@ format_out <- function(x) { #' #' @return a matrix, or depending on format of 'extent' a terra rast or raster object with elevation data #' @export -#' @importFrom spatial.datasources cop30 cop90 +#' @importFrom sds cop30 cop90 #' @examples #' #' image(elevation(), useRaster = TRUE) @@ -87,8 +87,9 @@ format_out <- function(x) { #' #' elevation(raster::raster(raster::extent(80, 120, -60, -40), res = 0.25, crs = "OGC:CRS84")) #' \donttest{ -#' elevation(raster::raster(raster::extent(c(-1, 1, -1, 1) * 15e3), nrows = 1024, ncols = 1024, +#' elevation(terra::rast(terra::ext(c(-1, 1, -1, 1) * 15e3), nrows = 256, ncols = 256, #' crs = "+proj=laea +lat_0=44.6371 +lon_0=-63.5923")) +#' #' } elevation <- function(extent = c(-180, 180, -90, 90), ..., dimension = NULL, projection = NULL, resample = "bilinear", source = NULL, threshold = 0.5) { @@ -115,8 +116,8 @@ elevation <- function(extent = c(-180, 180, -90, 90), ..., dimension = NULL, pro } if (is.null(source)) { - rso <- c(gebco(), - spatial.datasources::cop90(), spatial.datasources::cop30()) + rso <- c(sds::gebco(), + sds::cop90(), sds::cop30()) if (no_srtm30) rso <- rso[1:2] else rso <- rso[c(1, 3)] if (no_srtm) rso <- rso[1L] if (!no_srtm) print("SRTM in use, in addition to GEBCO") diff --git a/R/imagery.R b/R/imagery.R index f072107..a545e11 100644 --- a/R/imagery.R +++ b/R/imagery.R @@ -35,7 +35,7 @@ #' plt(imagery()) #' plt(imagery(c(100, 150, -60, -20), projection = "OGC:CRS84")) #' ## can't do yet -#' #plt(imagery(terra::rast()) +#' #plt(imagery(terra::rast())) #' #imagery(raster::raster()) #' imagery <- function(extent = c(-180, 180, -90, 90), ..., dimension = NULL, projection = "OGC:CRS84", resample = "near", source = NULL) { @@ -69,7 +69,7 @@ imagery <- function(extent = c(-180, 180, -90, 90), ..., dimension = NULL, proje } - +#' @importFrom sds wms_openstreetmap_tms #' @export #' @name imagery streetmap <- function(extent = c(-180, 180, -90, 90), ..., dimension = NULL, projection = "OGC:CRS84", resample = "cubic", source = NULL) { @@ -78,7 +78,7 @@ streetmap <- function(extent = c(-180, 180, -90, 90), ..., dimension = NULL, pro x <- format_out(list(extent = extent, dimension = dimension, projection = projection)) if (is.null(source)) { - rso <- .streetmap_sources["wms_openstreetmap_tms"] + rso <- sds::wms_openstreetmap_tms() } else { rso <- source } diff --git a/R/imfun.R b/R/imfun.R index a4d3bed..56b01d4 100644 --- a/R/imfun.R +++ b/R/imfun.R @@ -1,4 +1,5 @@ +#' @importFrom stats na.omit #' @importFrom graphics lines imfun <- function(X, coastline = TRUE) { if (!requireNamespace("ximage")) stop("{ximage} package required for imfun()") diff --git a/man/elevation.Rd b/man/elevation.Rd index a7fb429..4568100 100644 --- a/man/elevation.Rd +++ b/man/elevation.Rd @@ -55,7 +55,8 @@ elevation(raster::raster()) elevation(raster::raster(raster::extent(80, 120, -60, -40), res = 0.25, crs = "OGC:CRS84")) \donttest{ -elevation(raster::raster(raster::extent(c(-1, 1, -1, 1) * 15e3), nrows = 1024, ncols = 1024, +elevation(terra::rast(terra::ext(c(-1, 1, -1, 1) * 15e3), nrows = 256, ncols = 256, crs = "+proj=laea +lat_0=44.6371 +lon_0=-63.5923")) + } } diff --git a/man/imagery.Rd b/man/imagery.Rd index 4853982..6cdef57 100644 --- a/man/imagery.Rd +++ b/man/imagery.Rd @@ -75,7 +75,7 @@ plot(NA, xlim = c(0, nc), ylim = c(0, nr), asp = 1); plt(imagery()) plt(imagery(c(100, 150, -60, -20), projection = "OGC:CRS84")) ## can't do yet -#plt(imagery(terra::rast()) +#plt(imagery(terra::rast())) #imagery(raster::raster()) }