Skip to content

updates for #59 cran re-submission #68

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 9 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -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 }})
Expand All @@ -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
Expand All @@ -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")'
50 changes: 37 additions & 13 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: osmplotr
Title: Bespoke Images of 'OpenStreetMap' Data
Version: 0.3.5.009
Version: 0.3.5.018
Authors@R:
c(person(given = "Mark",
family = "Padgham",
Expand Down Expand Up @@ -48,4 +48,4 @@ VignetteBuilder:
knitr
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
10 changes: 5 additions & 5 deletions R/add-osm-surface.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
#' }
#'
Expand All @@ -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,
Expand All @@ -86,6 +85,7 @@
#' cols = heat.colors (30),
#' bg = "gray40"
#' )
#' \donttest{
#' print_osm_map (map)
#' }
#'
Expand All @@ -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,
Expand All @@ -106,14 +105,14 @@
#' bg = "gray60",
#' size = c (1.5, 0.5)
#' )
#' \donttest{
#' print_osm_map (map)
#' }
#'
#' # Adding multiple surfaces of either polygons or (lines/points) produces a
#' # '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,
Expand All @@ -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,
Expand All @@ -153,6 +152,7 @@
#' barlength = c (0.6, 0.99),
#' vertical = TRUE
#' )
#' \donttest{
#' print_osm_map (map)
#' }
#' @family maps-with-data
Expand Down
4 changes: 3 additions & 1 deletion R/connect-highways.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@
#'
#' @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"
#' )
#' # 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")
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion R/extract-highways.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

dl_hw_data <- function (highway_names, hw_abbrvs, bbox) {

cat ("Downloading OSM data ...\n")
message ("Downloading OSM data ...")

Check warning on line 74 in R/extract-highways.R

View check run for this annotation

Codecov / codecov/patch

R/extract-highways.R#L74

Added line #L74 was not covered by tests
p4s <- NULL
lens_old <- length (highway_names)
lens <- 0
Expand Down
10 changes: 5 additions & 5 deletions R/make-osm-map.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ()
Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion R/osm-structures.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions R/print-osm-map.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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}}.
Expand All @@ -21,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
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.018",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
Loading
Loading