From 72d27173027454df8fd2cfa9c5b4af75279ccbc3 Mon Sep 17 00:00:00 2001 From: rhijmans Date: Sat, 26 Aug 2023 09:20:42 -0700 Subject: [PATCH] x --- DESCRIPTION | 2 +- R/pointsToMatrix.R | 6 +++--- man/OSGB.Rd | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c4b2a3f..a03f5cf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: geosphere Type: Package Title: Spherical Trigonometry Version: 1.5-19 -Date: 2023-05-13 +Date: 2023-08-26 LinkingTo: Rcpp Imports: Rcpp, sp Depends: R (>= 3.0.0) diff --git a/R/pointsToMatrix.R b/R/pointsToMatrix.R index 3f171ea..737afb8 100644 --- a/R/pointsToMatrix.R +++ b/R/pointsToMatrix.R @@ -13,12 +13,12 @@ if (is.na(test)) { warning('Coordinate reference system of SpatVector is not set. Assuming it is degrees (longitude/latitude)!') } else if (checkLonLat) { - p <- project(p, "+proj=longlat") + p <- terra::project(p, "+proj=longlat") } } p <- terra::crds(p) } else if (inherits(p, 'SpatialPoints')) { - test <- !is.projected(p) + test <- !sp::is.projected(p) if (! isTRUE (test) ) { if (is.na(test)) { warning('Coordinate reference system of SpatialPoints object is not set. Assuming it is degrees (longitude/latitude)!') @@ -26,7 +26,7 @@ stop('Points are projected. They should be in degrees (longitude/latitude)') } } - p <- coordinates(p) + p <- sp::coordinates(p) } else if (is.data.frame(p)) { p <- as.matrix(p) } else if (is.vector(p)){ diff --git a/man/OSGB.Rd b/man/OSGB.Rd index d3e5b5d..1f19301 100644 --- a/man/OSGB.Rd +++ b/man/OSGB.Rd @@ -12,11 +12,11 @@ Great Britain. Or do the inverse operation to get coordinates for a grid code. } \usage{ -OSGB(x, precision, geo=FALSE, inverse=FALSE) +OSGB(xy, precision, geo=FALSE, inverse=FALSE) } \arguments{ - \item{x}{x coordinate pairs (vector, matrix, data.frame}; or grid codes if \code{inverse=TRUE}. + \item{xy}{x coordinate pairs (vector, matrix, data.frame}; or grid codes if \code{inverse=TRUE}. \item{precision}{character. One of "1m", "5m", "10m", "50m", "100m", "500m", "1km", "5km", "10km", "50km", "100km", "500km"} \item{geo}{If \code{TRUE} the input coordinates are in longitude/latitude (on the airy ellipsoid!). If \code{FALSE} they must be in the "OSGB36 / British National Grid" coordinate reference system ("EPSG:27700" or "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m")} \item{inverse}{If \code{TRUE}, coordinates are computed for the grid codes in \code{x}} @@ -33,7 +33,7 @@ pnts <- rbind(cbind(93555 , 256188), cbind(210637, 349798), cbind(696457, 481704)) -g <- OSGB(pnts, 3, geo=FALSE) +g <- OSGB(pnts, "1km", geo=FALSE) g OSGB(g, inverse=TRUE)