Is there a way to interpret (using sp, sf, etc.) grid locations expressed using the U.S. National Grid in R?
This is an example of a vector I would want to transform:
locations <- c("17T PH 8482 7766", "18T XL 6257 1639", "18T XL 6244 1636", "18T XL 6267 1673", "18T XL 6272 1671", "18T XL 6272 1674")
Ideally, I would want a way to get the Latitude/Longitude of the centroid of the grids, but even just being able to read them as a sf object would be half the work. Thank you!
I tried using the package mgrs (https://github.com/hrbrmstr/mgrs), but was unable to install it.
I can confirm that
mgrsbuilds and installs just fine withremotes::install_github("hrbrmstr/mgrs"). At least on a Windows 10 machine with R 4.3.2 & RTools43 installed. However, if you still need an alternative, you could use JavaScript libraries throughV8, e.g. https://github.com/proj4js/mgrs/ . It's kind of an overkill but perhaps an option if you can't build packages from source for whatever reason.Created on 2023-11-22 with reprex v2.0.2