Title: | Convert 'MGRS' ('Military Grid Reference System') Coordinates From/To Other Coordinate Systems |
---|---|
Description: | The 'Military Grid Reference System' ('MGRS') is the geocoordinate standard used by 'NATO' militaries for locating points on the earth. The 'MGRS' is derived from the 'Universal Transverse Mercator' ('UTM') grid system and the universal polar stereographic ('UPS') grid system, but uses a different labeling convention. The 'MGRS' is used for the entire earth. Methods are provided to convert 'MGRS' coordinates to and from other coordinate systems. |
Authors: | Bob Rudis [aut, cre] |
Maintainer: | Bob Rudis <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.4 |
Built: | 2025-02-13 11:42:42 UTC |
Source: | https://github.com/hrbrmstr/mgrs |
Convert latitude/longitude to MGRS string
latlng_to_mgrs(latitude, longitude, degrees = TRUE, precision = 5L)
latlng_to_mgrs(latitude, longitude, degrees = TRUE, precision = 5L)
latitude , longitude
|
coordinates |
degrees |
are latitude/longitude in degrees? Default: |
precision |
0:5; level of precision for the conversion. Default |
latlng_to_mgrs(42, -93)
latlng_to_mgrs(42, -93)
The 'Military Grid Reference System' ('MGRS') is the geocoordinate standard used by 'NATO' militaries for locating points on the earth. The 'MGRS' is derived from the 'Universal Transverse Mercator' ('UTM') grid system and the universal polar stereographic ('UPS') grid system, but uses a different labeling convention. The 'MGRS' is used for the entire earth. Methods are provided to convert 'MGRS' coordinates to and from other coordinate systems.
The origin of the MGRS grid, in the Pacific. Honolulu is in 4QFJ.
boB Rudis ([email protected])
Useful links:
MGRS coordinates represent a "square" with a certain level of precision. See Details for more info.
mgrs_precision(x)
mgrs_precision(x)
x |
character vector of MGRS grid references |
An MGRS grid reference is a point reference system. When the term 'grid square' is used, it can refer to a square with a side length of 10 km (6 mi), 1 km, 100 m (328 ft), 10 m or 1 m, depending on the precision of the coordinates provided. (In some cases, squares adjacent to a Grid Zone Junction (GZJ) are clipped, so polygon is a better descriptor of these areas.) The number of digits in the numerical location must be even: 0, 2, 4, 6, 8 or 10, depending on the desired precision. When changing precision levels, it is important to truncate rather than round the easting and northing values to ensure the more precise polygon will remain within the boundaries of the less precise polygon. Related to this is the primacy of the southwest corner of the polygon being the labeling point for an entire polygon. In instances where the polygon is not a square and has been clipped by a grid zone junction, the polygon keeps the label of the southwest corner as if it had not been clipped.
For example (spaces used for clarity):
precision level 6x8 degrees (in most cases) - function returns NA
for this
precision level 100 km
precision level 10 km
precision level 1 km
precision level 100 m
precision level 10 m
precision level 1 m
data frame with grid_ref
and precision
columns. precision
is in meters.
https://en.wikipedia.org/wiki/Military_Grid_Reference_System#Grid_zone_designation
grefs <- c("4Q", "4QFJ", "4QFJ16", "4QFJ1267", "4QFJ123678", "4QFJ12346789", "4QFJ1234567890") mgrs_precision(grefs)
grefs <- c("4Q", "4QFJ", "4QFJ16", "4QFJ1267", "4QFJ123678", "4QFJ12346789", "4QFJ1234567890") mgrs_precision(grefs)
Convert an MGRS string to latitude/longitude
mgrs_to_latlng(MGRS, degrees = TRUE, include_mgrs_ref = TRUE)
mgrs_to_latlng(MGRS, degrees = TRUE, include_mgrs_ref = TRUE)
MGRS |
an MGRS string |
degrees |
convert to degrees? Default: |
include_mgrs_ref |
if |
data.frame
vectorized
mgrs_to_latlng("15TWG0000049776")
mgrs_to_latlng("15TWG0000049776")
Convert MGRS to UPS
mgrs_to_ups(mgrs_string, include_mgrs_ref = TRUE)
mgrs_to_ups(mgrs_string, include_mgrs_ref = TRUE)
mgrs_string |
a character vector of MGRS strings |
include_mgrs_ref |
if |
data.frame
vectorized
mgrs_to_ups("ZGC2677330125")
mgrs_to_ups("ZGC2677330125")
Convert MGRS to UTM
mgrs_to_utm(mgrs_string, include_mgrs_ref = TRUE)
mgrs_to_utm(mgrs_string, include_mgrs_ref = TRUE)
mgrs_string |
acharacter vector of MGRS strings |
include_mgrs_ref |
if |
data.frame
vectorized
mgrs_to_utm("48PUV7729883034")
mgrs_to_utm("48PUV7729883034")
Convert UPS to Latitude/Longitude
ups_to_latlng(hemisphere, easting, northing, degrees = TRUE)
ups_to_latlng(hemisphere, easting, northing, degrees = TRUE)
hemisphere |
South ( |
easting , northing
|
easting (X) / northing (Y) (meters) |
degrees |
convert to degrees? Default: |
ups_to_latlng("N", 2426773, 1530125)
ups_to_latlng("N", 2426773, 1530125)
Convert UPS to MGRS
ups_to_mgrs(hemisphere, easting, northing, precision = 5L)
ups_to_mgrs(hemisphere, easting, northing, precision = 5L)
hemisphere |
South ( |
easting , northing
|
easting (X) / northing (Y) (meters) |
precision |
0:5; level of precision for the conversion. Default |
ups_to_mgrs("N", 2426773, 1530125)
ups_to_mgrs("N", 2426773, 1530125)
Convert UTM to Latitude/Longitude
utm_to_latlng(zone, hemisphere, easting, northing, degrees = TRUE)
utm_to_latlng(zone, hemisphere, easting, northing, degrees = TRUE)
zone |
1:60 |
hemisphere |
South ( |
easting , northing
|
easting (X) / northing (Y) (meters) |
degrees |
convert to degrees? Default: |
utm_to_latlng(48, "N", 377299, 1483035)
utm_to_latlng(48, "N", 377299, 1483035)
Convert UTM to MGRS
utm_to_mgrs(zone, hemisphere, easting, northing, precision = 5L)
utm_to_mgrs(zone, hemisphere, easting, northing, precision = 5L)
zone |
1:60 |
hemisphere |
South ( |
easting , northing
|
easting (X) / northing (Y) (meters) |
precision |
0:5; level of precision for the conversion. Default |
utm_to_mgrs(48, "N", 377299, 1483035)
utm_to_mgrs(48, "N", 377299, 1483035)