All Projects → hrbrmstr → mgrs

hrbrmstr / mgrs

Licence: Unknown, MIT licenses found Licenses found Unknown LICENSE MIT LICENSE.md
🌐 An R Package to Convert 'MGRS' (Military Grid Reference System) References From/To Other Coordiante Systems

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
r
7636 projects

Projects that are alternatives of or similar to mgrs

PHPCoord
PHPCoord is a PHP library to aid in handling coordinates. It can convert coordinates for a point from one system to another and also calculate distance between points
Stars: ✭ 78 (+290%)
Mutual labels:  projection, grid-references
isometric
A lightweight JavaScript library, written in TypeScript to create isometric projections using SVGs
Stars: ✭ 53 (+165%)
Mutual labels:  projection, coordinates
kirby-locator
A simple map & geolocation field, built on top of open-source services and Mapbox. Kirby 3 only.
Stars: ✭ 83 (+315%)
Mutual labels:  coordinates
latent space adventures
Buckle up, adventure in the styleGAN2-ada-pytorch network latent space awaits
Stars: ✭ 59 (+195%)
Mutual labels:  projection
pmod
Native cross platform library with language projection support for native code.
Stars: ✭ 22 (+10%)
Mutual labels:  projection
cft
Climate futures toolbox: easy MACA (MACAv2) climate data access 📦
Stars: ✭ 16 (-20%)
Mutual labels:  projection
EasyWayLocation
This library contain all utils related to google location. like, getting lat or long, Address and Location Setting dialog, many more...
Stars: ✭ 142 (+610%)
Mutual labels:  projection
attic
A collection of personal tiny tools - mirror of https://gitlab.com/hydrargyrum/attic
Stars: ✭ 17 (-15%)
Mutual labels:  coordinates
stylegan2-landmark-projection
Experimental repository attempting to project facial landmarks into the StyleGAN2 latent space.
Stars: ✭ 14 (-30%)
Mutual labels:  projection
Papart-examples
Papart examples
Stars: ✭ 29 (+45%)
Mutual labels:  projection
pypoman
Python module for polyhedral geometry
Stars: ✭ 26 (+30%)
Mutual labels:  projection
Tools Merge Image PointCloud
Project the PointCloud to the image & Generate the LiDAR PointCloud with color.
Stars: ✭ 39 (+95%)
Mutual labels:  projection
laravel-quasar
⏰📊✨Laravel Time Series - Provides an API to create and maintain data projections (statistics, aggregates, etc.) from your Eloquent models, and convert them to time series.
Stars: ✭ 78 (+290%)
Mutual labels:  projection
leaflet-locationpicker
Simple location picker on Leaflet map
Stars: ✭ 31 (+55%)
Mutual labels:  coordinates
iceaddr
Python package to look up information about Icelandic street addresses, postcodes and placenames
Stars: ✭ 21 (+5%)
Mutual labels:  coordinates
spacegrids
Analyze spatial Netcdf data: "Numpy on grids" (Python module)
Stars: ✭ 14 (-30%)
Mutual labels:  coordinates
GraphQL.RepoDB
A set of extensions for working with HotChocolate GraphQL and Database access with micro-orms such as RepoDb (or Dapper). This extension pack provides access to key elements such as Selections/Projections, Sort arguments, & Paging arguments in a significantly simplified facade so this logic can be leveraged in the Serivces/Repositories that enca…
Stars: ✭ 25 (+25%)
Mutual labels:  projection
mapshaper-proj
A JavaScript port of the Proj.4 map projection library.
Stars: ✭ 29 (+45%)
Mutual labels:  projection
KJCategories
Collection of native ios extensions and classes to boost development process. Such as UIKit, Foundation, QuartzCore, Accelerate, OpenCV, CoreGraphics, os and more. 超实用开发加速工具收集
Stars: ✭ 423 (+2015%)
Mutual labels:  projection
react-mops
🐶 Modify Orientation Position Size
Stars: ✭ 40 (+100%)
Mutual labels:  coordinates

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Signed by Signed commit % Linux build Status Windows build status Coverage Status Minimal R Version License

mgrs

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.

Essentially, a lightweight R wrapper around bits of https://svn.osgeo.org/gdal/trunk/gdal/frmts/nitf/.

Decent reference on MGRS & UTM (Universal Transverse Mercator): https://www.luomus.fi/en/utm-mgrs-atlas-florae-europaeae.

The origin of the MGRS grid, in the Pacific. Honolulu is in 4QFJ.

The origin of the MGRS grid, in the Pacific. Honolulu is in 4QFJ.

CC-BY-SA 3.0

What’s Inside The Tin

The following functions are implemented:

  • latlng_to_mgrs: Convert latitude/longitude to MGRS string
  • mgrs_precision: Return MGRS grid reference precision (in meters)
  • mgrs_to_latlng: Convert an MGRS string to latitude/longitude
  • mgrs_to_ups: Convert MGRS to UPS
  • mgrs_to_utm: Convert MGRS to UTM
  • ups_to_latlng: Convert UPS to Latitude/Longitude
  • ups_to_mgrs: Convert UPS to MGRS
  • utm_to_latlng: Convert UTM to Latitude/Longitude
  • utm_to_mgrs: Convert UTM to MGRS

Installation

install.packages("mgrs", repos = "https://cinc.rud.is")
# or
remotes::install_git("https://git.rud.is/hrbrmstr/mgrs.git")
# or
remotes::install_git("https://git.sr.ht/~hrbrmstr/mgrs")
# or
remotes::install_gitlab("hrbrmstr/mgrs")
# or
remotes::install_bitbucket("hrbrmstr/mgrs")
# or
remotes::install_github("hrbrmstr/mgrs")

NOTE: To use the ‘remotes’ install options you will need to have the {remotes} package installed.

Usage

library(mgrs)
library(hrbrthemes)
library(tidyverse)

# current version
packageVersion("mgrs")
## [1] '0.2.2'

Basics

mgrs_to_latlng("33UXP04")
##      mgrs      lat      lng
## 1 33UXP04 48.20535 16.34593

latlng_to_mgrs(48.20535, 16.34593)
## [1] "33UXP0000040000"

mgrs_to_latlng("33UXP0500444996")
##              mgrs      lat      lng
## 1 33UXP0500444996 48.24947 16.41449

latlng_to_mgrs(48.24948, 16.41449)
## [1] "33UXP0500344996"

mgrs_to_latlng("24XWT783908")
##          mgrs      lat       lng
## 1 24XWT783908 83.62738 -32.66879

latlng_to_mgrs(83.62738, -32.66879)
## [1] "25XEN0410486507"

utm_to_mgrs(48, "N", 377299, 1483035)
## [1] "48PUV7729983035"

mgrs_to_utm("48PUV7729883034")
##              mgrs zone hemisphere easting northing
## 1 48PUV7729883034   48          N  377298  1483034

ups_to_mgrs("N", 2426773, 1530125)
## [1] "ZGC2677330125"

mgrs_to_ups("ZGC2677330125")
##            mgrs hemisphere easting northing
## 1 ZGC2677330125          N 2426773  1530125

grefs <- c("4Q", "4QFJ", "4QFJ16", "4QFJ1267", "4QFJ123678",
           "4QFJ12346789", "4QFJ1234567890")
mgrs_precision(grefs)
## # A tibble: 7 x 2
##   grid_ref       precision
##   <chr>              <dbl>
## 1 4Q                    NA
## 2 4QFJ              100000
## 3 4QFJ16             10000
## 4 4QFJ1267            1000
## 5 4QFJ123678           100
## 6 4QFJ12346789          10
## 7 4QFJ1234567890         1

Better usage in the {tidyverse}

data.frame(
  id = 1:50, 
  mgrs = c("16SEB20", "09UXQ25", "12SVC48", "15SWU64", "11SKA54", "13SDC58", 
"18TYM20", "18SWH08", "17RML38", "17SKR77", "09RYR61", "12TTP62", 
"16TBK93", "16TEK73", "15TVG64", "14SNH75", "16SFG94", "15RWP68", 
"19TEL05", "18SUJ54", "19TBG89", "16TFN87", "15TUM73", "16SBB31", 
"15SWC44", "12TXS28", "14TML57", "11SND12", "19TCJ00", "18SWK62", 
"13SDU11", "18TVN87", "17SQV22", "14TMT13", "17TLE65", "14SPE73", 
"10TGP36", "18TTL93", "19TCG20", "17SNT42", "14TMQ40", "16SEE44", 
"14RNV27", "12SVJ72", "18TXQ90", "17SQB46", "11TKN95", "17SNC25", 
"16TBQ64", "13TCH16"),
  stringsAsFactors = FALSE
) -> sample_dta

dplyr::mutate(sample_dta, x = lapply(mgrs, mgrs_to_latlng, include_mgrs_ref = FALSE)) %>% 
  tidyr::unnest(x)
## # A tibble: 50 x 4
##       id mgrs      lat    lng
##    <int> <chr>   <dbl>  <dbl>
##  1     1 16SEB20  32.5  -86.8
##  2     2 09UXQ25  49.2 -127. 
##  3     3 12SVC48  34.2 -112. 
##  4     4 15SWU64  34.7  -92.3
##  5     5 11SKA54  36.5 -120. 
##  6     6 13SDC58  38.7 -106. 
##  7     7 18TYM20  41.5  -72.4
##  8     8 18SWH08  38.7  -75.0
##  9     9 17RML38  27.8  -81.7
## 10    10 17SKR77  32.2  -83.4
## # … with 40 more rows

Visual Verification

library(purrr)
library(ggplot2)

# precision == 1

c("16SEB20", "09UXQ25", "12SVC48", "15SWU64", "11SKA54", "13SDC58", 
"18TYM20", "18SWH08", "17RML38", "17SKR77", "09RYR61", "12TTP62", 
"16TBK93", "16TEK73", "15TVG64", "14SNH75", "16SFG94", "15RWP68", 
"19TEL05", "18SUJ54", "19TBG89", "16TFN87", "15TUM73", "16SBB31", 
"15SWC44", "12TXS28", "14TML57", "11SND12", "19TCJ00", "18SWK62", 
"13SDU11", "18TVN87", "17SQV22", "14TMT13", "17TLE65", "14SPE73", 
"10TGP36", "18TTL93", "19TCG20", "17SNT42", "14TMQ40", "16SEE44", 
"14RNV27", "12SVJ72", "18TXQ90", "17SQB46", "11TKN95", "17SNC25", 
"16TBQ64", "13TCH16") -> mgrs_state_centers

mgrs_to_latlng(mgrs_state_centers) %>% 
  ggplot(aes(lng, lat)) +
  geom_point(shape=22, size=2, color="black", fill="white") +
  coord_map("polyconic") +
  theme_ft_rc(grid="XY")

mgrs Metrics

Lang # Files (%) LoC (%) Blank lines (%) # Lines (%)
C 5 0.26 1854 0.74 334 0.62 918 0.52
C++ 2 0.11 342 0.14 63 0.12 99 0.06
C/C++ Header 5 0.26 181 0.07 74 0.14 546 0.31
R 6 0.32 91 0.04 28 0.05 158 0.09
Rmd 1 0.05 54 0.02 39 0.07 40 0.02

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].