PROJ

Straightforward R wrapper for the PROJ library (>=6)

https://github.com/hypertidy/proj

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.4%) to scientific vocabulary

Keywords from Contributors

geo
Last synced: 11 months ago · JSON representation

Repository

Straightforward R wrapper for the PROJ library (>=6)

Basic Info
Statistics
  • Stars: 16
  • Watchers: 3
  • Forks: 3
  • Open Issues: 7
  • Releases: 0
Created over 7 years ago · Last pushed over 1 year ago
Metadata Files
Readme Code of conduct

README.Rmd

---
output: github_document
editor_options: 
  chunk_output_type: console
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

library(reproj)

```



[![CRAN status](https://www.r-pkg.org/badges/version/PROJ)](https://CRAN.R-project.org/package=PROJ)
[![R-CMD-check](https://github.com/hypertidy/PROJ/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/hypertidy/PROJ/actions/workflows/R-CMD-check.yaml)

  
  
# PROJ


The goal of PROJ is to provide generic coordinate system transformations in R. 

This is a shared goal with the [reproj](https://cran.r-project.org/package=reproj)
package, and PROJ provides the infrastructure for later versions of the underlying library. 

PROJ provides basic coordinate transformations for generic numeric data in matrices or data frames. Transforming spatial data coordinates is a basic task independent of storage format.

PROJ is strictly for modern versions of the PROJ library. 

We can use 'auth:code' forms, PROJ.4 strings, full WKT2, or the name of a CRS as
found in the PROJ database, e.g 'WGS84', 'NAD27', etc. Full details are provided
in the [PROJ
documentation](https://proj.org/development/reference/functions.html#c.proj_create).


## Things to be aware of


* Input can be a data frame or a matrix, but internally input is assumed to be x, y, z, *and time*. So the output is always a 4-column list. 
* You can't use strings like "+init=epsg:4326" any more, it must be "EPSG:", and we use "OGC:CRS84" now.  
* You should know what your target projection is, and also what your source projection is. This is your responsibility. 
* PROJ assumes longitude/latitude order always by setting the PROJ library context *proj_normalize_for_visualization*. 

Please see [PROJ library documentation](https://proj.org/development/quickstart.html) for details on this. 



## Installation

On all systems do 

```R
install.packages("PROJ")
```

or 

```R
remotes::install_cran("PROJ")
```

To install the development version from Github do

```R
remotes::install_github("hypertidy/PROJ")
```


## Example

Minimal code example, two lon-lat coordinates to LAEA, and back. 

```{r minimal}
library(PROJ)
lon <- c(0, 147)
lat <- c(0, -42)
dst <- "+proj=laea +datum=WGS84 +lon_0=147 +lat_0=-42"
src <- "+proj=longlat +datum=WGS84"

## forward transformation
(xy <- proj_trans( cbind(lon, lat), dst, source = src))

## inverse transformation
proj_trans(cbind(xy$x_, xy$y_), src, source = dst)


## note that NAs propagate in the usual way
lon <- c(0, NA, 147)
lat <- c(NA, 0, -42)

proj_trans(cbind(lon, lat), src, source = dst)

```

A more realistic example with coastline map data. 


```{r example}
library(PROJ)
w <- PROJ::xymap
lon <- na.omit(w[,1])
lat <- na.omit(w[,2])
dst <- "+proj=laea +datum=WGS84 +lon_0=147 +lat_0=-42"
xy <- proj_trans(cbind(lon, lat), dst, source = "OGC:CRS84")
plot(xy$x_, xy$y_, pch = ".")

lonlat <- proj_trans(xy, src, source = dst)
plot(lonlat$x_, lonlat$y_, pch = ".")
```

## Convert projection strings

We can generate PROJ or within limitations WKT2 strings, format 0, 1, 2 for WKT, proj4string, projjson respectively. 

```{r WKT2, eval=TRUE}
cat(wkt2 <- proj_crs_text("OGC:CRS84"))

proj_crs_text(wkt2, format = 1L)


```



A geocentric example, suitable for plotting in rgl. 

```{r geocentric}
xyzt <- proj_trans(cbind(w[,1], w[,2]), z_ = rep(0, dim(w)[1L]), target = "+proj=cart +datum=WGS84", source = "OGC:CRS84")
plot(as.data.frame(xyzt[1:3]), pch = ".", asp = 1)
```

Geocentric transformations aren't used in R much, but some examples are found in the [quadmesh](https://CRAN.R-project.org/package=quadmesh) and [anglr](https://github.com/hypertidy/anglr) packages. 



---

Please note that the PROJ project is released with a
  [Contributor Code of Conduct](https://github.com/hypertidy/PROJ/blob/main/CODE_OF_CONDUCT.md).
  By contributing to this project, you agree to abide by its terms.

Owner

  • Name: hypertidy
  • Login: hypertidy
  • Kind: organization
  • Location: Hobart, Australia

[ ... ]

GitHub Events

Total
  • Watch event: 1
  • Push event: 2
  • Create event: 2
Last Year
  • Watch event: 1
  • Push event: 2
  • Create event: 2

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 296
  • Total Committers: 3
  • Avg Commits per committer: 98.667
  • Development Distribution Score (DDS): 0.03
Past Year
  • Commits: 36
  • Committers: 1
  • Avg Commits per committer: 36.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Michael Sumner m****r@g****m 287
Jeroen Ooms j****s@g****m 5
Dewey Dunnington d****y@f****t 4
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 37
  • Total pull requests: 21
  • Average time to close issues: 4 months
  • Average time to close pull requests: 4 days
  • Total issue authors: 4
  • Total pull request authors: 6
  • Average comments per issue: 2.05
  • Average comments per pull request: 2.29
  • Merged pull requests: 20
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mdsumner (30)
  • anthonynorth (4)
  • bigdataman2015 (1)
  • Tom-python0121 (1)
Pull Request Authors
  • anthonynorth (15)
  • mdsumner (6)
  • jeroen (3)
  • paleolimbot (2)
  • kalibera (2)
  • olivroy (2)
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 4,582 last-month
  • Total docker downloads: 20,888
  • Total dependent packages: 3
    (may contain duplicates)
  • Total dependent repositories: 3
    (may contain duplicates)
  • Total versions: 9
  • Total maintainers: 1
cran.r-project.org: PROJ

Generic Coordinate System Transformations Using 'PROJ'

  • Versions: 8
  • Dependent Packages: 2
  • Dependent Repositories: 3
  • Downloads: 4,582 Last month
  • Docker Downloads: 20,888
Rankings
Downloads: 6.1%
Dependent packages count: 13.7%
Stargazers count: 14.1%
Average: 16.2%
Dependent repos count: 16.5%
Forks count: 21.0%
Docker downloads count: 25.8%
Maintainers (1)
Last synced: 11 months ago
conda-forge.org: r-proj
  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent packages count: 28.8%
Dependent repos count: 34.0%
Average: 42.1%
Stargazers count: 48.3%
Forks count: 57.4%
Last synced: 12 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.0.2 depends
  • libproj >= 8.1.0 imports
  • knitr * suggests
  • rmarkdown * suggests
  • spelling * suggests
  • testthat >= 2.1.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/check-standard_yaml actions
  • actions/cache v1 composite
  • actions/checkout v1 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v2-branch composite
  • r-lib/actions/setup-r v2-branch composite
.github/workflows/pkgdown.yaml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc master composite
  • r-lib/actions/setup-r master composite
.github/workflows/test-coverage.yaml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc master composite
  • r-lib/actions/setup-r master composite
docker/clang/Dockerfile docker
  • tuxmake/clang-15 latest build
.github/workflows/R-CMD-check-autotools.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/rhub.yaml actions
  • actions/checkout v3 composite
  • r-hub/rhub2/actions/rhub-check v1 composite
  • r-hub/rhub2/actions/rhub-setup v1 composite
  • r-hub/rhub2/actions/rhub-setup-r v1 composite