Learn R Programming

UKFE (version 0.3.7)

GridRefConvert: Convert between British National Grid Reference (BNG) and Latitude and Longitude.

Description

Function to convert between BNG easting & northing and Latitude & Longitude (or vice versa).

Usage

GridRefConvert(x, fromBNG = TRUE)

Value

A data.frame with the converted grid references. Either latitude and longitude if BNG = TRUE. Or easting and northing if fromBNG = FALSE.

Arguments

x

A vector of length 2. Either latitude and longitude (if fromBNG = FALSE) or easting and northing (if fromBNG = TRUE).

fromBNG

A logical argument with a default of TRUE. When TRUE it converts from easting and northing to latitude and longitude. When FALSE it converts from latitude and longitude to easting and northing.

Author

Anthony Hammond

Examples

Run this code
#Get Latitude and Longitude for a BNG numeric reference.
GridRefConvert(c(462899, 187850))
#Now we'll get easting and northing as a function of latitude and longitude
GridRefConvert(c(51.6, -1), fromBNG = FALSE)

Run the code above in your browser using DataLab