Module: src/getGrFromCoords

Methods

(static) getGrFromCoords(x, y, fromProjection, toProjection, precisions) → {object}

Given a coordinate pair (British National Grid, Irish Grid, UTM zone 30N shorthand or WGS84), a two-letter code defining the projection of the passed in coordinates, a two-letter code defining the required output projection, and an array of numbers indicating the required output precisions, returns an object with the grid references at the requested precisions in the requested projection. If the requested projection is an empty string, automatic selection will be used based on location of input coords.
Parameters:
Name Type Description
x number the x coordinate (longitude if in WGS 84).
y number the y coordinate (latitude if in WGS 84).
fromProjection string two letter code for projection of the passed in coords.
toProjection string two letter code specifying the required output projection - leave empty for automatic selection.
precisions array.<number> array of numbers corresponding to the precisions of the requested grid references.
Source:
Returns:
- of the form {p10000: 'gr-hectad', p100: 'gr-6fig'} etc, with a property for each of the requested grid reference precisions.
Type
object