Skip to contents

ig_to_igr() converts valid Irish Grid(EPSG:29903) coordinates to Irish grid references at the specified precision.

Usage

ig_to_igr(x, digits = 3, precision = NULL, sep = "")

Arguments

x

A matrix containing Irish Grid X and Y coordinates in the first and second columns respectively.

digits

An integer, the number of digits for both easting and northing in the Irish grid references.

  • 0: equivalent to a precision of 100 km.

  • 1: equivalent to a precision of 10 km.

  • 2: equivalent to a precision of 1 km.

  • 3 (the default): equivalent to a precision of 100 m.

  • 4: equivalent to a precision of 10 m.

  • 5: equivalent to a precision of 1 m.

precision

An integer, the precision of the Irish grid references in metres: 1, 10, 100, 1000, 2000, 10000, or 100000. Overrides digits. Use 2000 to produce the tetrad form of Irish grid reference.

sep

A character string to place between the 100 km grid letter, easting, northing, and tetrad.

Value

A character vector of Irish grid references.

Details

Either digits or precision must be specified. precision overrides digits.

Examples

# A matrix of Irish Grid coordinates
m <- matrix(c(0, 412300, 0, 98700, 456000, 0), byrow = TRUE, ncol = 2)

m
#>        [,1]   [,2]
#> [1,]      0 412300
#> [2,]      0  98700
#> [3,] 456000      0

# Convert to Irish grid references
ig_to_igr(m)
#> [1] "A000123" "V000987" "Z560000"

# Insert a space between the 100 km grid letter, easting, and northing
ig_to_igr(m, sep = " ")
#> [1] "A 000 123" "V 000 987" "Z 560 000"

# Convert into Irish grid references with 4 digit easting and northing (10 m precision)
ig_to_igr(m, digits = 4)
#> [1] "A00001230" "V00009870" "Z56000000"

# Convert into Irish grid references with 1 km precision (2 digit easting and northing)
ig_to_igr(m, precision = 1000)
#> [1] "A0012" "V0098" "Z5600"

# Convert into Irish grid references with 2 km precision (tetrad form)
ig_to_igr(m, precision = 2000)
#> [1] "A01B" "V09E" "Z50Q"