From a611b2e2322a82767a9bf45252c6252b82f94478 Mon Sep 17 00:00:00 2001 From: mpadge Date: Fri, 14 Feb 2025 10:25:08 +0100 Subject: [PATCH 1/9] update roxygen2 version -> 7.3.2 --- DESCRIPTION | 4 ++-- codemeta.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2d21420..c8aa859 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: osmplotr Title: Bespoke Images of 'OpenStreetMap' Data -Version: 0.3.5.009 +Version: 0.3.5.010 Authors@R: c(person(given = "Mark", family = "Padgham", @@ -48,4 +48,4 @@ VignetteBuilder: knitr Encoding: UTF-8 LazyData: true -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 diff --git a/codemeta.json b/codemeta.json index 807cff2..e72929e 100755 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci/osmplotr", "issueTracker": "https://github.com/ropensci/osmplotr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.3.5.009", + "version": "0.3.5.010", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", From 011566abf62e4360faeb896af2b5d3fc0e9e635b Mon Sep 17 00:00:00 2001 From: mpadge Date: Fri, 14 Feb 2025 10:26:23 +0100 Subject: [PATCH 2/9] document missing return value for #59 --- DESCRIPTION | 2 +- R/print-osm-map.R | 3 ++- codemeta.json | 2 +- man/print_osm_map.Rd | 5 ++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c8aa859..30413e6 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: osmplotr Title: Bespoke Images of 'OpenStreetMap' Data -Version: 0.3.5.010 +Version: 0.3.5.011 Authors@R: c(person(given = "Mark", family = "Padgham", diff --git a/R/print-osm-map.R b/R/print-osm-map.R index 36afd51..70bac60 100644 --- a/R/print-osm-map.R +++ b/R/print-osm-map.R @@ -3,7 +3,7 @@ #' Prints an OSM map produced with \code{osmplotr} to a specified graphics #' device. #' -#' @param map The map to be printed; a \code{ggplot2} object produced by +#' @param map The map to be printed; a \pkg{ggplot2} object produced by #' \code{osmplotr}. #' @param width Desired width of graphics device. #' @param height Desired height of graphics device. Ignored if width specified. @@ -12,6 +12,7 @@ #' not explicitly provided). #' @param units Units for height and width of graphics device. #' @param dpi Resolution of graphics device (dots-per-inch). +#' @return (Invisibly) the \pkg{ggplot2} map object. #' #' @seealso \code{\link{osm_basemap}}, \code{\link{add_osm_objects}}, #' \code{\link{make_osm_map}}. diff --git a/codemeta.json b/codemeta.json index e72929e..77c5710 100755 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci/osmplotr", "issueTracker": "https://github.com/ropensci/osmplotr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.3.5.010", + "version": "0.3.5.011", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", diff --git a/man/print_osm_map.Rd b/man/print_osm_map.Rd index ab52d28..56529ae 100644 --- a/man/print_osm_map.Rd +++ b/man/print_osm_map.Rd @@ -15,7 +15,7 @@ print_osm_map( ) } \arguments{ -\item{map}{The map to be printed; a \code{ggplot2} object produced by +\item{map}{The map to be printed; a \pkg{ggplot2} object produced by \code{osmplotr}.} \item{width}{Desired width of graphics device.} @@ -31,6 +31,9 @@ not explicitly provided).} \item{dpi}{Resolution of graphics device (dots-per-inch).} } +\value{ +(Invisibly) the \pkg{ggplot2} map object. +} \description{ Prints an OSM map produced with \code{osmplotr} to a specified graphics device. From f6748cf48d0e849ae8cb9a76dea0ec12b996ea7b Mon Sep 17 00:00:00 2001 From: mpadge Date: Fri, 14 Feb 2025 10:30:36 +0100 Subject: [PATCH 3/9] update gha workflows --- .github/workflows/R-CMD-check.yaml | 22 ++++++------ .github/workflows/test-coverage.yaml | 50 ++++++++++++++++++++-------- DESCRIPTION | 2 +- codemeta.json | 2 +- 4 files changed, 50 insertions(+), 26 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 3531e95..562fe0f 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,17 +1,16 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: - - main + branches: [main, master] pull_request: - branches: - - main -name: R-CMD-check +name: R-CMD-check.yaml -jobs: +permissions: read-all +jobs: R-CMD-check: - runs-on: ${{ matrix.config.os }} name: ${{ matrix.config.os }} (${{ matrix.config.r }}) @@ -20,19 +19,17 @@ jobs: fail-fast: false matrix: config: - - {os: macOS-latest, r: 'release'} + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} - {os: ubuntu-latest, r: 'oldrel-1'} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - R_KEEP_PKG_SOURCE: yes GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -49,3 +46,6 @@ jobs: needs: check - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 795f147..e050312 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,26 +1,21 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: - - main + branches: [main, master] pull_request: - branches: - - main -name: test-coverage +name: test-coverage.yaml -jobs: +permissions: read-all +jobs: test-coverage: - - runs-on: ubuntu-latest - env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v4 - uses: r-lib/actions/setup-r@v2 @@ -29,9 +24,38 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::covr + extra-packages: any::covr, any::xml2 needs: coverage - name: Test coverage - run: covr::codecov() + run: | + cov <- covr::package_coverage( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + covr::to_cobertura(cov) shell: Rscript {0} + + - uses: codecov/codecov-action@v4 + with: + # Fail if error if not on PR, or if on PR and token is given + fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} + file: ./cobertura.xml + plugin: noop + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package diff --git a/DESCRIPTION b/DESCRIPTION index 30413e6..8948eda 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: osmplotr Title: Bespoke Images of 'OpenStreetMap' Data -Version: 0.3.5.011 +Version: 0.3.5.012 Authors@R: c(person(given = "Mark", family = "Padgham", diff --git a/codemeta.json b/codemeta.json index 77c5710..e8dcfce 100755 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci/osmplotr", "issueTracker": "https://github.com/ropensci/osmplotr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.3.5.011", + "version": "0.3.5.012", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", From f920ac4c2a959579444f138ac3842fac5d27d7d6 Mon Sep 17 00:00:00 2001 From: mpadge Date: Fri, 14 Feb 2025 10:32:28 +0100 Subject: [PATCH 4/9] styler one test file --- DESCRIPTION | 2 +- codemeta.json | 2 +- tests/testthat/test-print-map.R | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8948eda..bd98940 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: osmplotr Title: Bespoke Images of 'OpenStreetMap' Data -Version: 0.3.5.012 +Version: 0.3.5.013 Authors@R: c(person(given = "Mark", family = "Padgham", diff --git a/codemeta.json b/codemeta.json index e8dcfce..2a57fea 100755 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci/osmplotr", "issueTracker": "https://github.com/ropensci/osmplotr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.3.5.012", + "version": "0.3.5.013", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", diff --git a/tests/testthat/test-print-map.R b/tests/testthat/test-print-map.R index 06ce1a0..19d10dd 100644 --- a/tests/testthat/test-print-map.R +++ b/tests/testthat/test-print-map.R @@ -21,13 +21,13 @@ test_that ("print_osm_map", { fname <- paste0 ("map.", e) # expect_silent ( - print_osm_map ( - map, - width = 5, - height = 4, - filename = fname, - units = "in" - ) + print_osm_map ( + map, + width = 5, + height = 4, + filename = fname, + units = "in" + ) # ) expect_true (fname %in% list.files ()) } From 3bce1c3dc473ad444b6f8bddbca51d2a9c445013 Mon Sep 17 00:00:00 2001 From: mpadge Date: Fri, 14 Feb 2025 10:35:10 +0100 Subject: [PATCH 5/9] improve 'test_all' conditions to match job not workflow name --- DESCRIPTION | 2 +- codemeta.json | 2 +- tests/testthat/test-add-groups.R | 5 -- tests/testthat/test-connect-highways.R | 4 - tests/testthat/test-extract-objects.R | 102 ++++++++++++------------- tests/testthat/test-print-map.R | 6 +- 6 files changed, 54 insertions(+), 67 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bd98940..9c79016 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: osmplotr Title: Bespoke Images of 'OpenStreetMap' Data -Version: 0.3.5.013 +Version: 0.3.5.014 Authors@R: c(person(given = "Mark", family = "Padgham", diff --git a/codemeta.json b/codemeta.json index 2a57fea..32065b0 100755 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci/osmplotr", "issueTracker": "https://github.com/ropensci/osmplotr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.3.5.013", + "version": "0.3.5.014", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", diff --git a/tests/testthat/test-add-groups.R b/tests/testthat/test-add-groups.R index 58c56a1..9badea7 100644 --- a/tests/testthat/test-add-groups.R +++ b/tests/testthat/test-add-groups.R @@ -1,8 +1,3 @@ -context ("add-groups") - -test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") | - identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage")) - test_that ("basemap", { expect_error (add_osm_groups (), "map must be supplied") expect_error (add_osm_groups (NULL), "map must be a ggplot2 object") diff --git a/tests/testthat/test-connect-highways.R b/tests/testthat/test-connect-highways.R index ccb405a..76a54d1 100644 --- a/tests/testthat/test-connect-highways.R +++ b/tests/testthat/test-connect-highways.R @@ -1,7 +1,3 @@ -context ("connect-highways") - -# test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") | -# identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage")) test_all <- identical (Sys.getenv ("MPADGE_LOCAL"), "true") source ("../stub.R") diff --git a/tests/testthat/test-extract-objects.R b/tests/testthat/test-extract-objects.R index b86d2b3..e9dace2 100644 --- a/tests/testthat/test-extract-objects.R +++ b/tests/testthat/test-extract-objects.R @@ -1,7 +1,5 @@ -context ("extract-objects") - -test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") | - identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage")) +test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") || + identical (Sys.getenv ("GITHUB_JOB"), "test-coverage")) test_that ("missing objects", { expect_error (extract_osm_objects (), "key can not be NULL") @@ -27,55 +25,55 @@ test_that ("key missing", { ) }) -if (curl::has_internet () && test_all) { +skip_if (!curl::has_internet ()) +skip_if (!test_all) - test_that ("invalid key", { - bbox <- get_bbox (c (-0.12, 51.51, -0.11, 51.52)) - expect_warning ( - suppressMessages ( - extract_osm_objects (bbox = bbox, key = "aaa") - ), - "No valid data returned" - ) - }) +test_that ("invalid key", { + bbox <- get_bbox (c (-0.12, 51.51, -0.11, 51.52)) + expect_warning ( + suppressMessages ( + extract_osm_objects (bbox = bbox, key = "aaa") + ), + "No valid data returned" + ) +}) - test_that ("valid key", { - bbox <- get_bbox (c (-0.12, 51.518, -0.118, 51.52)) - dat <- extract_osm_objects (bbox = bbox, key = "building") - expect_is (dat, "sf") - dat <- extract_osm_objects ( - bbox = bbox, key = "building", - sf = FALSE - ) - expect_is (dat, "SpatialPolygonsDataFrame") - }) +test_that ("valid key", { + bbox <- get_bbox (c (-0.12, 51.518, -0.118, 51.52)) + dat <- extract_osm_objects (bbox = bbox, key = "building") + expect_is (dat, "sf") + dat <- extract_osm_objects ( + bbox = bbox, key = "building", + sf = FALSE + ) + expect_is (dat, "SpatialPolygonsDataFrame") +}) - test_that ("extra_pairs", { - key <- "route" - value <- "bicycle" - extra_pairs <- c ("name", "London Cycle Network") - bbox <- get_bbox (c (0, 51.5, 0.1, 51.6)) - dat <- extract_osm_objects ( - bbox = bbox, key = key, - value = value, - extra_pairs = extra_pairs - ) - expect_true (nrow (dat) > 0) - expect_is (dat, "sf") - }) +test_that ("extra_pairs", { + key <- "route" + value <- "bicycle" + extra_pairs <- c ("name", "London Cycle Network") + bbox <- get_bbox (c (0, 51.5, 0.1, 51.6)) + dat <- extract_osm_objects ( + bbox = bbox, key = key, + value = value, + extra_pairs = extra_pairs + ) + expect_true (nrow (dat) > 0) + expect_is (dat, "sf") +}) - test_that ("sp objects", { - key <- "route" - value <- "bicycle" - extra_pairs <- c ("name", "London Cycle Network") - bbox <- get_bbox (c (0, 51.5, 0.1, 51.6)) - dat <- extract_osm_objects ( - bbox = bbox, key = key, - value = value, - extra_pairs = extra_pairs, - sf = FALSE - ) - expect_true (nrow (dat) > 0) - expect_is (dat, "Spatial") - }) -} # end if has_internet +test_that ("sp objects", { + key <- "route" + value <- "bicycle" + extra_pairs <- c ("name", "London Cycle Network") + bbox <- get_bbox (c (0, 51.5, 0.1, 51.6)) + dat <- extract_osm_objects ( + bbox = bbox, key = key, + value = value, + extra_pairs = extra_pairs, + sf = FALSE + ) + expect_true (nrow (dat) > 0) + expect_is (dat, "Spatial") +}) diff --git a/tests/testthat/test-print-map.R b/tests/testthat/test-print-map.R index 19d10dd..149e7fb 100644 --- a/tests/testthat/test-print-map.R +++ b/tests/testthat/test-print-map.R @@ -1,7 +1,5 @@ -context ("print-osm-map") - -test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") | - identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage")) +test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") || + identical (Sys.getenv ("GITHUB_JOB"), "test-coverage")) test_that ("print_osm_map", { From 587c3a4358e056162d268a05e1d6826dcb6a4319 Mon Sep 17 00:00:00 2001 From: mpadge Date: Fri, 14 Feb 2025 10:37:51 +0100 Subject: [PATCH 6/9] dontrun -> donttest in osm-structures for #59 --- DESCRIPTION | 2 +- R/osm-structures.R | 2 +- codemeta.json | 2 +- man/osm_structures.Rd | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9c79016..bc57bf0 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: osmplotr Title: Bespoke Images of 'OpenStreetMap' Data -Version: 0.3.5.014 +Version: 0.3.5.015 Authors@R: c(person(given = "Mark", family = "Padgham", diff --git a/R/osm-structures.R b/R/osm-structures.R index 64cb2b5..0922265 100644 --- a/R/osm-structures.R +++ b/R/osm-structures.R @@ -24,9 +24,9 @@ #' structures <- c ("highway", "park", "ameniiy", "tree") #' structs <- osm_structures (structures = structures, col_scheme = "light") #' # make_osm_map returns potentially modified list of data -#' \dontrun{ #' dat <- make_osm_map (osm_data = london, structures = structs) #' # map contains updated $osm_data and actual map in $map +#' \donttest{ #' print_osm_map (dat$map) #' } #' @family construction diff --git a/codemeta.json b/codemeta.json index 32065b0..4eab0d9 100755 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci/osmplotr", "issueTracker": "https://github.com/ropensci/osmplotr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.3.5.014", + "version": "0.3.5.015", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", diff --git a/man/osm_structures.Rd b/man/osm_structures.Rd index 794c333..68dda82 100644 --- a/man/osm_structures.Rd +++ b/man/osm_structures.Rd @@ -36,9 +36,9 @@ osm_structures () structures <- c ("highway", "park", "ameniiy", "tree") structs <- osm_structures (structures = structures, col_scheme = "light") # make_osm_map returns potentially modified list of data -\dontrun{ dat <- make_osm_map (osm_data = london, structures = structs) # map contains updated $osm_data and actual map in $map +\donttest{ print_osm_map (dat$map) } } From a7f0881254532a6ef3f410552144ef7389b31400 Mon Sep 17 00:00:00 2001 From: mpadge Date: Fri, 14 Feb 2025 10:50:06 +0100 Subject: [PATCH 7/9] rm more dontrun statements for #59 --- DESCRIPTION | 2 +- R/add-osm-surface.R | 10 +++++----- R/make-osm-map.R | 2 +- R/print-osm-map.R | 3 ++- codemeta.json | 2 +- man/add_osm_surface.Rd | 10 +++++----- man/make_osm_map.Rd | 2 +- man/print_osm_map.Rd | 3 ++- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bc57bf0..daf0c9d 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: osmplotr Title: Bespoke Images of 'OpenStreetMap' Data -Version: 0.3.5.015 +Version: 0.3.5.016 Authors@R: c(person(given = "Mark", family = "Padgham", diff --git a/R/add-osm-surface.R b/R/add-osm-surface.R index 92bae9e..1473091 100755 --- a/R/add-osm-surface.R +++ b/R/add-osm-surface.R @@ -66,9 +66,9 @@ #' y = as.vector (t (array (y, dim = c (n, n)))), #' z = x * y #' ) -#' \dontrun{ #' map <- osm_basemap (bbox = bbox, bg = "gray20") #' map <- add_osm_surface (map, dat_B, dat = dat, cols = heat.colors (30)) +#' \donttest{ #' print_osm_map (map) #' } #' @@ -77,7 +77,6 @@ #' # 'dat': #' d <- sqrt ((dat$x - mean (dat$x))^2 + (dat$y - mean (dat$y))^2) #' dat <- dat [which (d < 0.01), ] -#' \dontrun{ #' map <- osm_basemap (bbox = bbox, bg = "gray20") #' map <- add_osm_surface ( #' map, @@ -86,6 +85,7 @@ #' cols = heat.colors (30), #' bg = "gray40" #' ) +#' \donttest{ #' print_osm_map (map) #' } #' @@ -97,7 +97,6 @@ #' # These data are also provided in #' dat_HP <- london$dat_HP #' cols <- adjust_colours (heat.colors (30), adj = -0.2) # darken by 20% -#' \dontrun{ #' map <- add_osm_surface ( #' map, #' dat_HP, @@ -106,6 +105,7 @@ #' bg = "gray60", #' size = c (1.5, 0.5) #' ) +#' \donttest{ #' print_osm_map (map) #' } #' @@ -113,7 +113,6 @@ #' # 'ggplot2' warning, and forces the colour gradient to revert to the last #' # given value. #' dat_T <- london$dat_T # trees -#' \dontrun{ #' map <- osm_basemap (bbox = bbox, bg = "gray20") #' map <- add_osm_surface ( #' map, @@ -139,11 +138,11 @@ #' size = c (5, 2), #' shape = c (8, 1) #' ) +#' \donttest{ #' print_osm_map (map) # 'dat_HP' is in 'topo.colors' not 'heat.colors' #' } #' #' # Add axes and colourbar -#' \dontrun{ #' map <- add_axes (map) #' map <- add_colourbar ( #' map, @@ -153,6 +152,7 @@ #' barlength = c (0.6, 0.99), #' vertical = TRUE #' ) +#' \donttest{ #' print_osm_map (map) #' } #' @family maps-with-data diff --git a/R/make-osm-map.R b/R/make-osm-map.R index cc8d828..c2eeaf9 100644 --- a/R/make-osm-map.R +++ b/R/make-osm-map.R @@ -42,8 +42,8 @@ #' dat <- make_osm_map (osm_data = london, structures = structs) #' # or download data automatically using a defined bounding boox #' bbox <- get_bbox (c (-0.15, 51.5, -0.10, 51.52)) -#' \dontrun{ #' dat <- make_osm_map (bbox = bbox, structures = structs) +#' \donttest{ #' print_osm_map (dat$map) #' } #' @family construction diff --git a/R/print-osm-map.R b/R/print-osm-map.R index 70bac60..7817c0b 100644 --- a/R/print-osm-map.R +++ b/R/print-osm-map.R @@ -22,8 +22,9 @@ #' map <- osm_basemap (bbox = bbox, bg = "gray20") #' map <- add_osm_objects (map, london$dat_BNR, col = "gray40") #' print_osm_map (map, width = 7) # prints to screen device -#' \dontrun{ +#' \donttest{ #' print_osm_map (map, file = "map.png", width = 500, units = "px") +#' file.remove ("map.png") #' } #' @family construction #' @export diff --git a/codemeta.json b/codemeta.json index 4eab0d9..523c87f 100755 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci/osmplotr", "issueTracker": "https://github.com/ropensci/osmplotr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.3.5.015", + "version": "0.3.5.016", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", diff --git a/man/add_osm_surface.Rd b/man/add_osm_surface.Rd index 5321f61..d3d105e 100644 --- a/man/add_osm_surface.Rd +++ b/man/add_osm_surface.Rd @@ -89,9 +89,9 @@ dat <- data.frame ( y = as.vector (t (array (y, dim = c (n, n)))), z = x * y ) -\dontrun{ map <- osm_basemap (bbox = bbox, bg = "gray20") map <- add_osm_surface (map, dat_B, dat = dat, cols = heat.colors (30)) +\donttest{ print_osm_map (map) } @@ -100,7 +100,6 @@ print_osm_map (map) # 'dat': d <- sqrt ((dat$x - mean (dat$x))^2 + (dat$y - mean (dat$y))^2) dat <- dat [which (d < 0.01), ] -\dontrun{ map <- osm_basemap (bbox = bbox, bg = "gray20") map <- add_osm_surface ( map, @@ -109,6 +108,7 @@ map <- add_osm_surface ( cols = heat.colors (30), bg = "gray40" ) +\donttest{ print_osm_map (map) } @@ -120,7 +120,6 @@ print_osm_map (map) # These data are also provided in dat_HP <- london$dat_HP cols <- adjust_colours (heat.colors (30), adj = -0.2) # darken by 20\% -\dontrun{ map <- add_osm_surface ( map, dat_HP, @@ -129,6 +128,7 @@ map <- add_osm_surface ( bg = "gray60", size = c (1.5, 0.5) ) +\donttest{ print_osm_map (map) } @@ -136,7 +136,6 @@ print_osm_map (map) # 'ggplot2' warning, and forces the colour gradient to revert to the last # given value. dat_T <- london$dat_T # trees -\dontrun{ map <- osm_basemap (bbox = bbox, bg = "gray20") map <- add_osm_surface ( map, @@ -162,11 +161,11 @@ map <- add_osm_surface ( size = c (5, 2), shape = c (8, 1) ) +\donttest{ print_osm_map (map) # 'dat_HP' is in 'topo.colors' not 'heat.colors' } # Add axes and colourbar -\dontrun{ map <- add_axes (map) map <- add_colourbar ( map, @@ -176,6 +175,7 @@ map <- add_colourbar ( barlength = c (0.6, 0.99), vertical = TRUE ) +\donttest{ print_osm_map (map) } } diff --git a/man/make_osm_map.Rd b/man/make_osm_map.Rd index 38115f7..714a95b 100644 --- a/man/make_osm_map.Rd +++ b/man/make_osm_map.Rd @@ -60,8 +60,8 @@ structs <- osm_structures (structures = structures, col_scheme = "light") dat <- make_osm_map (osm_data = london, structures = structs) # or download data automatically using a defined bounding boox bbox <- get_bbox (c (-0.15, 51.5, -0.10, 51.52)) -\dontrun{ dat <- make_osm_map (bbox = bbox, structures = structs) +\donttest{ print_osm_map (dat$map) } } diff --git a/man/print_osm_map.Rd b/man/print_osm_map.Rd index 56529ae..cbf7012 100644 --- a/man/print_osm_map.Rd +++ b/man/print_osm_map.Rd @@ -43,8 +43,9 @@ bbox <- get_bbox (c (-0.13, 51.5, -0.11, 51.52)) map <- osm_basemap (bbox = bbox, bg = "gray20") map <- add_osm_objects (map, london$dat_BNR, col = "gray40") print_osm_map (map, width = 7) # prints to screen device -\dontrun{ +\donttest{ print_osm_map (map, file = "map.png", width = 500, units = "px") +file.remove ("map.png") } } \seealso{ From 6ce416c50ac077eca9f57ff62792afcd4218835c Mon Sep 17 00:00:00 2001 From: mpadge Date: Fri, 14 Feb 2025 10:53:05 +0100 Subject: [PATCH 8/9] rm final dontrun statements for #59 --- DESCRIPTION | 2 +- R/connect-highways.R | 4 +++- codemeta.json | 2 +- man/connect_highways.Rd | 4 +++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index daf0c9d..628088e 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: osmplotr Title: Bespoke Images of 'OpenStreetMap' Data -Version: 0.3.5.016 +Version: 0.3.5.017 Authors@R: c(person(given = "Mark", family = "Padgham", diff --git a/R/connect-highways.R b/R/connect-highways.R index 42df4ce..ea8dc5d 100644 --- a/R/connect-highways.R +++ b/R/connect-highways.R @@ -31,7 +31,6 @@ #' #' @examples #' bbox <- get_bbox (c (-0.13, 51.5, -0.11, 51.52)) -#' \dontrun{ #' highways <- c ( #' "Monmouth.St", "Short.?s.Gardens", "Endell.St", "Long.Acre", #' "Upper.Saint.Martin" @@ -39,9 +38,11 @@ #' # Note that dots signify "anything", including whitespace and apostrophes, #' # and that '?' denotes optional previous character and so here matches #' # both "Shorts Gardens" and "Short's Gardens" +#' \dontrun{ #' highways1 <- connect_highways (highways = highways, bbox = bbox, plot = TRUE) #' highways <- c ("Endell.St", "High.Holborn", "Drury.Lane", "Long.Acre") #' highways2 <- connect_highways (highways = highways, bbox = bbox, plot = TRUE) +#' } #' #' # Use of 'connect_highways' to highlight a region on a map #' map <- osm_basemap (bbox = bbox, bg = "gray20") @@ -50,6 +51,7 @@ #' # bbox = bbox) #' # Those data are part of 'osmplotr': #' dat_BNR <- london$dat_BNR # Non-residential buildings +#' \dontrun{ #' groups <- list (highways1, highways2) #' map <- add_osm_groups (map, #' obj = dat_BNR, groups = groups, diff --git a/codemeta.json b/codemeta.json index 523c87f..60768d8 100755 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci/osmplotr", "issueTracker": "https://github.com/ropensci/osmplotr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.3.5.016", + "version": "0.3.5.017", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", diff --git a/man/connect_highways.Rd b/man/connect_highways.Rd index c713afc..8319df3 100644 --- a/man/connect_highways.Rd +++ b/man/connect_highways.Rd @@ -42,7 +42,6 @@ problems! } \examples{ bbox <- get_bbox (c (-0.13, 51.5, -0.11, 51.52)) -\dontrun{ highways <- c ( "Monmouth.St", "Short.?s.Gardens", "Endell.St", "Long.Acre", "Upper.Saint.Martin" @@ -50,9 +49,11 @@ highways <- c ( # Note that dots signify "anything", including whitespace and apostrophes, # and that '?' denotes optional previous character and so here matches # both "Shorts Gardens" and "Short's Gardens" +\dontrun{ highways1 <- connect_highways (highways = highways, bbox = bbox, plot = TRUE) highways <- c ("Endell.St", "High.Holborn", "Drury.Lane", "Long.Acre") highways2 <- connect_highways (highways = highways, bbox = bbox, plot = TRUE) +} # Use of 'connect_highways' to highlight a region on a map map <- osm_basemap (bbox = bbox, bg = "gray20") @@ -61,6 +62,7 @@ map <- osm_basemap (bbox = bbox, bg = "gray20") # bbox = bbox) # Those data are part of 'osmplotr': dat_BNR <- london$dat_BNR # Non-residential buildings +\dontrun{ groups <- list (highways1, highways2) map <- add_osm_groups (map, obj = dat_BNR, groups = groups, From 7da942484d816ca4ccccd588f1b523d9fb53b9e2 Mon Sep 17 00:00:00 2001 From: mpadge Date: Fri, 14 Feb 2025 10:59:26 +0100 Subject: [PATCH 9/9] change 'cat' -> 'message' for #59 --- DESCRIPTION | 2 +- R/extract-highways.R | 2 +- R/make-osm-map.R | 8 ++++---- codemeta.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 628088e..26c9e5b 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: osmplotr Title: Bespoke Images of 'OpenStreetMap' Data -Version: 0.3.5.017 +Version: 0.3.5.018 Authors@R: c(person(given = "Mark", family = "Padgham", diff --git a/R/extract-highways.R b/R/extract-highways.R index 3b27952..770a304 100644 --- a/R/extract-highways.R +++ b/R/extract-highways.R @@ -71,7 +71,7 @@ abbreviate_hwy_names <- function (highway_names, nletters = 2) { dl_hw_data <- function (highway_names, hw_abbrvs, bbox) { - cat ("Downloading OSM data ...\n") + message ("Downloading OSM data ...") p4s <- NULL lens_old <- length (highway_names) lens <- 0 diff --git a/R/make-osm-map.R b/R/make-osm-map.R index c2eeaf9..ade6bb6 100644 --- a/R/make-osm-map.R +++ b/R/make-osm-map.R @@ -131,9 +131,9 @@ get_bbox_from_data <- function (osm_data) { get_missing_osm_data <- function (osm_data, structures, bbox, dat_prefix) { - cat ( - "Downloading and extracting OSM data for", - nrow (structures), "structures ...\n" + message ( + "Downloading and extracting OSM data for ", + nrow (structures), " structures ..." ) pb <- txtProgressBar (max = 1, style = 3) t0 <- proc.time () @@ -163,7 +163,7 @@ get_missing_osm_data <- function (osm_data, structures, bbox, dat_prefix) { setTxtProgressBar (pb, i / nrow (structures)) } close (pb) - cat ("That took ", (proc.time () - t0) [3], "s\n", sep = "") + message ("That took ", (proc.time () - t0) [3], "s\n", sep = "") list ("indx" = indx, "osm_data" = osm_data) } diff --git a/codemeta.json b/codemeta.json index 60768d8..e7c1414 100755 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci/osmplotr", "issueTracker": "https://github.com/ropensci/osmplotr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.3.5.017", + "version": "0.3.5.018", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R",