Browse Source

fixed CRAN check errors

delete
boB Rudis 6 years ago
parent
commit
9f89aa48be
No known key found for this signature in database GPG Key ID: 2A514A4997464560
  1. 1
      .Rbuildignore
  2. 8
      R/precision.r
  3. 28
      README.Rmd
  4. 198
      README.gfm-ascii_identifiers
  5. 112
      README.md
  6. BIN
      README_files/figure-gfm/unnamed-chunk-4-1.png
  7. 45
      appveyor.yml
  8. 7
      man/mgrs_precision.Rd

1
.Rbuildignore

@ -10,3 +10,4 @@
^doc$
^CONDUCT\.md$
^codecov\.yml$
^appveyor\.yml$

8
R/precision.r

@ -20,7 +20,7 @@
#' For example (spaces used for clarity):
#'
#' \describe{
#' \item{4Q}{precision level 6° × 8° (in most cases) - function returns \code{NA} for this}
#' \item{4Q}{precision level 6x8 degrees (in most cases) - function returns \code{NA} for this}
#' \item{4QFJ}{precision level 100 km}
#' \item{4QFJ 1 6}{precision level 10 km}
#' \item{4QFJ 12 67}{precision level 1 km}
@ -35,9 +35,9 @@
#' @references <https://en.wikipedia.org/wiki/Military_Grid_Reference_System#Grid_zone_designation>
#' @export
#' @examples
# grefs <- c("4Q", "4QFJ", "4QFJ16", "4QFJ1267", "4QFJ123678",
# "4QFJ12346789", "4QFJ1234567890")
# mgrs_precision(grefs)
#' grefs <- c("4Q", "4QFJ", "4QFJ16", "4QFJ1267", "4QFJ123678",
#' "4QFJ12346789", "4QFJ1234567890")
#' mgrs_precision(grefs)
mgrs_precision <- function(x) {
x <- gsub("[[:space:]]", "", x)

28
README.Rmd

@ -4,16 +4,23 @@ editor_options:
chunk_output_type: console
---
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/0.1.0/active.svg)](http://www.repostatus.org/#active)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/hrbrmstr/mgrs?branch=master&svg=true)](https://ci.appveyor.com/project/hrbrmstr/mgrs)
[![codecov](https://codecov.io/gh/hrbrmstr/mgrs/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/mgrs)
[![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/mgrs.svg?branch=master)](https://travis-ci.org/hrbrmstr/mgrs)
[![keybase verified](https://img.shields.io/badge/keybase-verified-brightgreen.svg)](https://gist.github.com/hrbrmstr/be2f2c14fd78cac24697)
`mgrs` : Convert 'MGRS' (Military Grid Reference System) References To and From Other Coordinate Systems
# mgrs
Convert 'MGRS' (Military Grid Reference System) References To and From Other Coordinate Systems
## Description
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>.
## What's inside the tin?
The following functions are implemented:
- `latlng_to_mgrs`: Convert latitude/longitude to MGRS string
@ -24,7 +31,7 @@ The following functions are implemented:
- `utm_to_mgrs`: Convert UTM to MGRS
- `mgrs_precision`: Return MGRS grid reference precision (in meters)
### TODO
## TODO
- Find all the folks/projects I need to add in the `DESCRIPTION` for auth/ctb & docs
- Vectorize ALL THE THINGS
@ -33,7 +40,7 @@ The following functions are implemented:
- Precision validation
- More tests (basic testing is done)
### Installation
## Installation
```{r eval=FALSE}
devtools::install_github("hrbrmstr/mgrs")
@ -43,7 +50,7 @@ devtools::install_github("hrbrmstr/mgrs")
options(width=120)
```
### Usage
## Usage
```{r message=FALSE, warning=FALSE, error=FALSE}
library(mgrs)
@ -100,17 +107,6 @@ mgrs_to_latlng(mgrs_state_centers) %>%
coord_map("polyconic")
```
### Test Results
```{r test}
library(mgrs)
library(testthat)
date()
test_dir("tests/")
```
### Code of Conduct
## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.

198
README.gfm-ascii_identifiers

@ -1,198 +0,0 @@
[![Project Status: Active - The project has reached a stable, usable
state and is being actively
developed.](http://www.repostatus.org/badges/0.1.0/active.svg)](http://www.repostatus.org/#active)
[![codecov](https://codecov.io/gh/hrbrmstr/mgrs/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/mgrs)
[![Travis-CI Build
Status](https://travis-ci.org/hrbrmstr/mgrs.svg?branch=master)](https://travis-ci.org/hrbrmstr/mgrs)
[![keybase
verified](https://img.shields.io/badge/keybase-verified-brightgreen.svg)](https://gist.github.com/hrbrmstr/be2f2c14fd78cac24697)
`mgrs` : Convert ‘MGRS’ (Military Grid Reference System) References 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 following functions are implemented:
- `latlng_to_mgrs`: Convert latitude/longitude to MGRS string
- `mgrs_to_latlng`: Convert an MGRS string to latitude/longitude
**(now returns a `data.frame`)**
- `mgrs_to_ups`: Convert MGRS to UPS
- `mgrs_to_utm`: Convert MGRS to UTM
- `ups_to_mgrs`: Convert UPS to MGRS
- `utm_to_mgrs`: Convert UTM to MGRS
- `mgrs_precision`: Return MGRS grid reference precision (in meters)
### TODO
- Find all the folks/projects I need to add in the `DESCRIPTION` for
auth/ctb & docs
- Vectorize ALL THE THINGS
- <strike>Add in support for the other MGRS conversion
thingys</strike>
- More error checking (basic checking is done)
- Precision validation
- More tests (basic testing is done)
### Installation
``` r
devtools::install_github("hrbrmstr/mgrs")
```
### Usage
``` r
library(mgrs)
# current verison
packageVersion("mgrs")
```
## [1] '0.1.0'
``` r
mgrs_to_latlng("33UXP04")
```
## mgrs lat lng
## 1 33UXP04 48.20535 16.34593
``` r
latlng_to_mgrs(48.20535, 16.34593)
```
## [1] "33UXP0000040000"
``` r
mgrs_to_latlng("33UXP0500444996")
```
## mgrs lat lng
## 1 33UXP0500444996 48.24947 16.41449
``` r
latlng_to_mgrs(48.24948, 16.41449)
```
## [1] "33UXP0500344996"
``` r
mgrs_to_latlng("24XWT783908")
```
## mgrs lat lng
## 1 24XWT783908 83.62738 -32.66879
``` r
latlng_to_mgrs(83.62738, -32.66879)
```
## [1] "25XEN0410486507"
``` r
utm_to_mgrs(48, "N", 377299, 1483035)
```
## [1] "48PUV7729983035"
``` r
mgrs_to_utm("48PUV7729883034")
```
## mgrs zone hemisphere easting northing
## 1 48PUV7729883034 48 N 377298 1483034
``` r
ups_to_mgrs("N", 2426773, 1530125)
```
## [1] "ZGC2677330125"
``` r
mgrs_to_ups("ZGC2677330125")
```
## mgrs hemisphere easting northing
## 1 ZGC2677330125 N 2426773 1530125
``` r
grefs <- c("4Q", "4QFJ", "4QFJ16", "4QFJ1267", "4QFJ123678",
"4QFJ12346789", "4QFJ1234567890")
mgrs_precision(grefs)
```
## grid_ref precision
## 1 4Q NA
## 2 4QFJ 1e+05
## 3 4QFJ16 1e+04
## 4 4QFJ1267 1e+03
## 5 4QFJ123678 1e+02
## 6 4QFJ12346789 1e+01
## 7 4QFJ1234567890 1e+00
### Visual Verification
``` r
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="white", fill="black") +
coord_map("polyconic")
```
<img src="README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-4-1.png" width="960" />
### Test Results
``` r
library(mgrs)
library(testthat)
```
##
## Attaching package: 'testthat'
## The following object is masked from 'package:purrr':
##
## is_null
``` r
date()
```
## [1] "Mon Nov 13 09:46:39 2017"
``` r
test_dir("tests/")
```
## testthat results ========================================================================================================
## OK: 10 SKIPPED: 0 FAILED: 0
##
## DONE ===================================================================================================================
### Code of Conduct
Please note that this project is released with a [Contributor Code of
Conduct](CONDUCT.md). By participating in this project you agree to
abide by its terms.

112
README.md

@ -1,37 +1,59 @@
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/0.1.0/active.svg)](http://www.repostatus.org/#active) [![codecov](https://codecov.io/gh/hrbrmstr/mgrs/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/mgrs) [![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/mgrs.svg?branch=master)](https://travis-ci.org/hrbrmstr/mgrs) [![keybase verified](https://img.shields.io/badge/keybase-verified-brightgreen.svg)](https://gist.github.com/hrbrmstr/be2f2c14fd78cac24697)
[![Project Status: Active - The project has reached a stable, usable
state and is being actively
developed.](http://www.repostatus.org/badges/0.1.0/active.svg)](http://www.repostatus.org/#active)
[![AppVeyor Build
Status](https://ci.appveyor.com/api/projects/status/github/hrbrmstr/mgrs?branch=master&svg=true)](https://ci.appveyor.com/project/hrbrmstr/mgrs)
[![codecov](https://codecov.io/gh/hrbrmstr/mgrs/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/mgrs)
[![Travis-CI Build
Status](https://travis-ci.org/hrbrmstr/mgrs.svg?branch=master)](https://travis-ci.org/hrbrmstr/mgrs)
[![keybase
verified](https://img.shields.io/badge/keybase-verified-brightgreen.svg)](https://gist.github.com/hrbrmstr/be2f2c14fd78cac24697)
`mgrs` : Convert 'MGRS' (Military Grid Reference System) References To and From Other Coordinate Systems
# mgrs
Essentially, a lightweight R wrapper around bits of <https://svn.osgeo.org/gdal/trunk/gdal/frmts/nitf/>.
Convert ‘MGRS’ (Military Grid Reference System) References To and From
Other Coordinate Systems
Decent reference on MGRS & UTM (Universal Transverse Mercator): <https://www.luomus.fi/en/utm-mgrs-atlas-florae-europaeae>.
## Description
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>.
## What’s inside the tin?
The following functions are implemented:
- `latlng_to_mgrs`: Convert latitude/longitude to MGRS string
- `mgrs_to_latlng`: Convert an MGRS string to latitude/longitude **(now returns a `data.frame`)**
- `mgrs_to_ups`: Convert MGRS to UPS
- `mgrs_to_utm`: Convert MGRS to UTM
- `ups_to_mgrs`: Convert UPS to MGRS
- `utm_to_mgrs`: Convert UTM to MGRS
- `latlng_to_mgrs`: Convert latitude/longitude to MGRS string
- `mgrs_to_latlng`: Convert an MGRS string to latitude/longitude
**(now returns a `data.frame`)**
- `mgrs_to_ups`: Convert MGRS to UPS
- `mgrs_to_utm`: Convert MGRS to UTM
- `ups_to_mgrs`: Convert UPS to MGRS
- `utm_to_mgrs`: Convert UTM to MGRS
- `mgrs_precision`: Return MGRS grid reference precision (in meters)
### TODO
## TODO
- Find all the folks/projects I need to add in the `DESCRIPTION` for auth/ctb & docs
- Vectorize ALL THE THINGS
- <strike>Add in support for the other MGRS conversion thingys</strike>
- More error checking (basic checking is done)
- Precision validation
- More tests (basic testing is done)
- Find all the folks/projects I need to add in the `DESCRIPTION` for
auth/ctb & docs
- Vectorize ALL THE THINGS
- <strike>Add in support for the other MGRS conversion
thingys</strike>
- More error checking (basic checking is done)
- Precision validation
- More tests (basic testing is done)
### Installation
## Installation
``` r
devtools::install_github("hrbrmstr/mgrs")
```
### Usage
## Usage
``` r
library(mgrs)
@ -107,6 +129,21 @@ mgrs_to_ups("ZGC2677330125")
## mgrs hemisphere easting northing
## 1 ZGC2677330125 N 2426773 1530125
``` r
grefs <- c("4Q", "4QFJ", "4QFJ16", "4QFJ1267", "4QFJ123678",
"4QFJ12346789", "4QFJ1234567890")
mgrs_precision(grefs)
```
## grid_ref precision
## 1 4Q NA
## 2 4QFJ 1e+05
## 3 4QFJ16 1e+04
## 4 4QFJ1267 1e+03
## 5 4QFJ123678 1e+02
## 6 4QFJ12346789 1e+01
## 7 4QFJ1234567890 1e+00
### Visual Verification
``` r
@ -131,37 +168,10 @@ mgrs_to_latlng(mgrs_state_centers) %>%
coord_map("polyconic")
```
<img src="README_files/figure-markdown_github/unnamed-chunk-4-1.png" width="960" />
### Test Results
``` r
library(mgrs)
library(testthat)
```
##
## Attaching package: 'testthat'
## The following object is masked from 'package:purrr':
##
## is_null
``` r
date()
```
## [1] "Mon Apr 10 13:28:40 2017"
``` r
test_dir("tests/")
```
## testthat results ========================================================================================================
## OK: 10 SKIPPED: 0 FAILED: 0
##
## DONE ===================================================================================================================
<img src="README_files/figure-gfm/unnamed-chunk-4-1.png" width="960" />
### Code of Conduct
## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.
Please note that this project is released with a [Contributor Code of
Conduct](CONDUCT.md). By participating in this project you agree to
abide by its terms.

BIN
README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-4-1.png → README_files/figure-gfm/unnamed-chunk-4-1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 146 KiB

45
appveyor.yml

@ -0,0 +1,45 @@
# DO NOT CHANGE the "init" and "install" sections below
# Download script file from GitHub
init:
ps: |
$ErrorActionPreference = "Stop"
Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
Import-Module '..\appveyor-tool.ps1'
install:
ps: Bootstrap
cache:
- C:\RLibrary
# Adapt as necessary starting from here
build_script:
- travis-tool.sh install_deps
test_script:
- travis-tool.sh run_tests
on_failure:
- 7z a failure.zip *.Rcheck\*
- appveyor PushArtifact failure.zip
artifacts:
- path: '*.Rcheck\**\*.log'
name: Logs
- path: '*.Rcheck\**\*.out'
name: Logs
- path: '*.Rcheck\**\*.fail'
name: Logs
- path: '*.Rcheck\**\*.Rout'
name: Logs
- path: '\*_*.tar.gz'
name: Bits
- path: '\*_*.zip'
name: Bits

7
man/mgrs_precision.Rd

@ -32,7 +32,7 @@ clipped.
For example (spaces used for clarity):
\describe{
\item{4Q}{precision level 6° × 8° (in most cases) - function returns \code{NA} for this}
\item{4Q}{precision level 6x8 degrees (in most cases) - function returns \code{NA} for this}
\item{4QFJ}{precision level 100 km}
\item{4QFJ 1 6}{precision level 10 km}
\item{4QFJ 12 67}{precision level 1 km}
@ -41,6 +41,11 @@ For example (spaces used for clarity):
\item{4QFJ 12345 67890}{precision level 1 m}
}
}
\examples{
grefs <- c("4Q", "4QFJ", "4QFJ16", "4QFJ1267", "4QFJ123678",
"4QFJ12346789", "4QFJ1234567890")
mgrs_precision(grefs)
}
\references{
\url{https://en.wikipedia.org/wiki/Military_Grid_Reference_System#Grid_zone_designation}
}

Loading…
Cancel
Save