This function returns the grid reference's northing in metres.

northing(x, ...)

# S3 method for gridref
northing(grid_reference, centre = FALSE)

Arguments

grid_reference

A Great British or Irish grid reference character string with class gridref.

centre

Should the northing be for the lower left hand corner (default FALSE) or the centre point (TRUE).

Value

The northing of grid reference in metres.

Details

It can check either British or Irish grid references up to 10 figure (1m precision), including tetrads (2000m precision).

REST API

A REST API endpoint is available once a Plumber router has been created and can be requested by adding _api to the end of the function.

The API returns "" instead of NULL so that it may be used with the dplyr::mutate function. Wrap the API call with dplyr::na_if to convert "" to NA.

suppressPackageStartupMessages({
  library(store)
  suppressWarnings({
    library(plumber)
  })
})
pr("../R/gridref_api.R") %>%
  pr_run(port = 8000)

See also

Other grid reference functions: easting(), gridsquare_geometry(), hectad(), hectare(), monad(), pentad(), precision(), projection(), tetrad()

Examples

suppressPackageStartupMessages({ library(store) suppressWarnings({ library(dplyr) library(janitor) }) }) grid_references <- nbn_demonstration_dataset %>% clean_names() %>% slice_tail(n = 15) %>% select(grid_reference) %>% mutate(grid_reference = as_gridref(grid_reference)) # add northing column for the centre point suppressPackageStartupMessages({ suppressWarnings({ library(dplyr) }) }) grid_references %>% rowwise() %>% mutate(northing_corner = northing(grid_reference), northing_centre = northing(grid_reference, centre = TRUE))
#> # A tibble: 15 x 3 #> # Rowwise: #> grid_reference northing_corner northing_centre #> <gridref> <dbl> <dbl> #> 1 TL2384 284000 284500 #> 2 TL232839 283900 283950 #> 3 TL2385 285000 285500 #> 4 TL231840 284000 284050 #> 5 TL232839 283900 283950 #> 6 TL23248346 283460 283465 #> 7 TL23568493 284930 284935 #> 8 TL23448505 285050 285055 #> 9 TL23128324 283240 283245 #> 10 TL234850 285000 285050 #> 11 TL234846 284600 284650 #> 12 TL232839 283900 283950 #> 13 TL231841 284100 284150 #> 14 TL226846 284600 284650 #> 15 TL2384 284000 284500