bng_to_xy {osbng} | R Documentation |
Convert BNG References
Description
Create British National Grid references from coordinates at a specific resolution or convert grid reference objects to coordinates at a grid position.
Usage
bng_to_xy(
bng_ref,
position = c("lower-left", "upper-left", "upper-right", "lower-right", "centre"),
...
)
xy_to_bng(...)
## S3 method for class 'numeric'
xy_to_bng(easting, northing, resolution, ...)
## S3 method for class 'matrix'
xy_to_bng(x, resolution, ...)
## S3 method for class 'data.frame'
xy_to_bng(df, cols = c("eastings", "northings"), resolution, ...)
Arguments
bng_ref |
vector of type |
position |
character indicating which point location of the BNG grid square is returned. Default is the lower-left corner. |
... |
additional parameters, not currently used |
easting |
numeric vector of coordinates |
northing |
numeric vector of coordinates |
resolution |
target BNG grid resolution. Can be specified as a numeric or character vector |
x |
two column matrix of eastings and northings |
df |
data.frame with columns of coordinates to convert |
cols |
column names or indices within |
Details
Coordinates must be in British National Grid projection (EPSG:27700) using eastings and northings in meters. These functions do not support coordinate transformations.
Value
-
xy_to_bng
: vector ofBNGReference
objects -
bng_to_xy
: two-column matrix of eastings and northings
Examples
bng_to_xy(as_bng_reference("SU"), "lower-left")
bng_to_xy(as_bng_reference("SU 3 1"), "lower-left")
bng_to_xy(as_bng_reference("SU 3 1 NE"), "centre")
bng_to_xy(as_bng_reference("SU 37289 15541"), "centre")
xy_to_bng(437289, 115541, "100km")
xy_to_bng(437289, 115541, "10km")
xy_to_bng(437289, 115541, "5km")
xy_to_bng(437289, 115541, 1)