Learn R Programming

rnrfa (version 2.1.0.5)

osg_parse: Converts OS Grid Reference to BNG/WGS coordinates.

Description

This function converts an Ordnance Survey (OS) grid reference to easting/northing or latitude/longitude coordinates.

Usage

osg_parse(grid_refs, coord_system = c("BNG", "WGS84"))

Value

vector made of two elements: the easting and northing (by default) or latitude and longitude coordinates.

Arguments

grid_refs

This is a string (or a character vector) that contains the OS grid Reference.

coord_system

By default, this is "BNG" which stands for British National Grids. The other option is to set coord_system = "WGS84", which returns latitude/longitude coordinates (more info can be found here https://www.epsg-registry.org/).

Author

Claudia Vitolo (Ilaria Prosdocimi ported to sf)

Examples

Run this code
if (FALSE) {
  # single entry
  osg_parse(grid_refs = "TQ722213")

  # multiple entries
  osg_parse(grid_refs = c("SN831869","SN829838"))

  # multiple entries with missing values, NA will be returned
  osg_parse(grid_refs = c("SN831869",NA, "SN829838", NA))
}

Run the code above in your browser using DataLab