From b8e15702d338ae31a6105d929cba66ab17beabf8 Mon Sep 17 00:00:00 2001 From: "Jeffrey W. Hollister" Date: Fri, 24 Mar 2023 14:25:55 -0400 Subject: [PATCH] Cleaned up local notes, trying to fix actions on Ubuntu --- .github/workflows/check-standard.yaml | 13 ++++++++++++- DESCRIPTION | 2 +- NEWS.md | 3 --- R/internal.R | 6 +++--- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check-standard.yaml b/.github/workflows/check-standard.yaml index 8ca4630..28b780a 100644 --- a/.github/workflows/check-standard.yaml +++ b/.github/workflows/check-standard.yaml @@ -16,7 +16,7 @@ jobs: matrix: config: - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"} + - {os: windows-latest, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/latest"} - {os: macos-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/latest"} - {os: ubuntu-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} @@ -58,6 +58,17 @@ jobs: do eval sudo $cmd done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') + + - name: "Install spatial libraries on linux" + if: runner.os == 'Linux' + run: sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev + + - name: "Install spatial libraries on macOS" + if: runner.os == 'macOS' + run: | + # conflicts with gfortran from r-lib/actions when linking gcc + rm '/usr/local/bin/gfortran' + brew install pkg-config gdal proj geos sqlite3 - name: Install dependencies on windows and mac if: runner.os != 'Linux' diff --git a/DESCRIPTION b/DESCRIPTION index c1a5e21..0f04eb0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,7 +35,7 @@ Imports: License: CC0 Encoding: UTF-8 LazyData: true -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.3 Suggests: testthat, knitr, diff --git a/NEWS.md b/NEWS.md index 7486f96..ea33ac6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,9 +6,6 @@ elevatr 0.4.3 (2023-04-XX) - Switched long lat check from my homespun thing to st::sf_is_longlat - Fixed EPQS API URL. Moved to a new one. Thanks @haas4726 for the catch. - - - elevatr 0.4.2 (2021-12-28) ============= diff --git a/R/internal.R b/R/internal.R index 08a3d90..10a972d 100644 --- a/R/internal.R +++ b/R/internal.R @@ -70,7 +70,7 @@ loc_check <- function(locations, prj = NULL){ nfeature <- nrow(locations) } - if(class(locations)=="data.frame"){ + if(inherits(locations, "data.frame")){ if(is.null(prj)){ stop("Please supply a valid crs via locations or prj.") } @@ -92,7 +92,7 @@ loc_check <- function(locations, prj = NULL){ proj4string = sp::CRS(SRS_string = prj), data = df) } - } else if(class(locations) == "SpatialPoints"){ + } else if(inherits(locations, "SpatialPoints")){ crs_check <- is.na(st_crs(st_as_sf(locations))) if(crs_check & is.null(prj)){ @@ -114,7 +114,7 @@ loc_check <- function(locations, prj = NULL){ elevation = vector("numeric", nrow( sp::coordinates(locations))))) - } else if(class(locations) == "SpatialPointsDataFrame"){ + } else if(inherits(locations,"SpatialPointsDataFrame")){ crs_check <- is.na(st_crs(st_as_sf(locations))) if(crs_check & is.null(prj)) { stop("Please supply a valid crs via locations or prj.")