Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Aug 26, 2023
1 parent bab00ed commit 72d2717
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions R/pointsToMatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
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)!')
} else if (checkLonLat) {
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)){
Expand Down
6 changes: 3 additions & 3 deletions man/OSGB.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand All @@ -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)
Expand Down

0 comments on commit 72d2717

Please sign in to comment.