geoops

UNSUPPORTED - geoops does spatial operations on GeoJSON

https://github.com/sckott/geoops

Science Score: 26.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
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.0%) to scientific vocabulary

Keywords

geojson geospatial polygon r r-package rstats

Keywords from Contributors

genome taxize sequenced-genomes proteome ncbi-genbank metagenomics meta-analysis genome-retrieval genome-annotation ensembl-servers
Last synced: 6 months ago · JSON representation

Repository

UNSUPPORTED - geoops does spatial operations on GeoJSON

Basic Info
Statistics
  • Stars: 25
  • Watchers: 7
  • Forks: 4
  • Open Issues: 3
  • Releases: 5
Topics
geojson geospatial polygon r r-package rstats
Created almost 10 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog Contributing License Code of conduct Codemeta

README.Rmd

geoops
======

```{r echo=FALSE}
library("knitr")
hook_output <- knitr::knit_hooks$get("output")
knitr::knit_hooks$set(output = function(x, options) {
  lines <- options$output.lines
  if (is.null(lines)) {
    return(hook_output(x, options)) # pass to default hook
  }
  x <- unlist(strsplit(x, "\n"))
  more <- "..."
  if (length(lines) == 1) { # first n lines
    if (length(x) > lines) {
      # truncate the output, but add ....
      x <- c(head(x, lines), more)
    }
  } else {
    x <- c(
      if (abs(lines[1]) > 1) more else NULL,
      x[lines],
      if (length(x) > lines[abs(length(lines))]) more else NULL
    )
  }
  # paste these lines together
  x <- paste(c(x, ""), collapse = "\n")
  hook_output(x, options)
})

knitr::opts_chunk$set(
  comment = "#>",
  collapse = TRUE,
  warning = FALSE,
  message = FALSE,
  fig.path = "man/figures/"
)
```

[![Project Status: Unsupported – The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired.](https://www.repostatus.org/badges/latest/unsupported.svg)](https://www.repostatus.org/#unsupported)
[![R-CMD-check](https://github.com/sckott/geoops/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/sckott/geoops/actions/workflows/R-CMD-check.yaml)
[![codecov](https://codecov.io/gh/sckott/geoops/branch/main/graph/badge.svg)](https://codecov.io/gh/sckott/geoops)

`geoops` does spatial operations on GeoJSON.

`geoops` is inspired by the JS library turf (http://turfjs.org/). It's
tagline is _Advanced geospatial analysis for browsers and node_.
Turf works only with GeoJSON, as does `geoops`. I don't know JS that well,
but it's easy enough to understand the language, so I've been porting
Turf to C++ wrapped up in R. The C++ so we can have fast performance. We've
also wrapped the Turf JS library itself in the package
lawn (https://github.com/ropensci/lawn), but we should be able to get better
performance out of C++.

`geoops` has a ways to go to include all the methods that Turf has, but
we'll get there eventually.

All data is expected to be in WGS-84.

We use a library from Niels Lohmann (https://github.com/nlohmann/json)
for working with JSON in C++.

See also:

* geojson: https://github.com/ropensci/geojson

Package API:

```{r echo=FALSE}
cat(paste(" -", paste(getNamespaceExports("geoops"), collapse = "\n - ")))
```


## Installation

Stable version

```{r eval=FALSE}
install.packages("geoops")
```

Dev version

```{r eval=FALSE}
remotes::install_github("sckott/geoops")
```

```{r}
library("geoops")
```

See the vignette (link here) to get started.


## comparison to rgeos

FIXME!!! remove `rgeos` stuff as that pkg is gone

### distance

```{r eval=FALSE}
pt1 <- '{"type":"Feature","properties":{"marker-color":"#f00"},"geometry":{"type":"Point","coordinates":[-75.343,39.984]}}'
pt2 <- '{"type":"Feature","properties":{"marker-color":"#0f0"},"geometry":{"type":"Point","coordinates":[-75.534,39.123]}}'
library(rgeos)
rgeospt1 <- rgeos::readWKT("POINT(0.5 0.5)")
rgeospt2 <- rgeos::readWKT("POINT(2 2)")
```

```{r eval=FALSE}
microbenchmark::microbenchmark(
  rgeos = rgeos::gDistance(rgeospt1, rgeospt2),
  geoops = geoops::geo_distance(pt1, pt2, units = "miles"),
  times = 10000L
)
```

### nearest

```{r eval=FALSE}
point1 <- '{"type":["Feature"],"properties":{"marker-color":["#0f0"]},"geometry":{"type":["Point"],"coordinates":[28.9658,41.0101]}}'
point2 <- '{"type":["FeatureCollection"],"features":[{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[28.9739,41.0111]}},{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[28.9485,41.0242]}},{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[28.9387,41.0133]}}]}'
points <- '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[28.9739,41.0111]}},{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[28.9485,41.0242]}},{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[28.9387,41.0133]}}]}'
g1 <- readWKT("MULTILINESTRING((34 54, 60 34), (0 10, 50 10, 100 50))")
g2 <- readWKT("POINT(100 30)")
```

```{r eval=FALSE}
microbenchmark::microbenchmark(
  rgeos = rgeos::gNearestPoints(g1, g2),
  geoops = geoops::geo_nearest(point1, points),
  times = 10000L
)
```

## Example use case

expand Get some GeoJSON data, a FeatureCollection of Polygons ```{r} file <- system.file("examples/zillow_or.geojson", package = "geoops") x <- paste0(readLines(file), collapse = "") ``` Break each polygon into separate JSON string ```{r} library("jqr") polys <- unclass(jq(x, ".features[]")) ``` Using `geo_area`, calculate the area of the polygon ```{r} areas <- vapply(polys, geo_area, 1, USE.NAMES = FALSE) ``` Visualize area of the polygons as a histogram ```{r} hist(areas, main = "") ``` Visualize some of the polygons, all of them ```{r} library(leaflet) leaflet() %>% addProviderTiles(provider = "OpenStreetMap.Mapnik") %>% addGeoJSON(geojson = x) %>% setView(lng = -123, lat = 45, zoom = 7) ``` Just one of them ```{r} leaflet() %>% addProviderTiles(provider = "OpenStreetMap.Mapnik") %>% addGeoJSON(geojson = polys[1]) %>% setView(lng = -122.7, lat = 45.48, zoom = 13) ```
## Meta * Please [report any issues or bugs](https://github.com/sckott/geoops/issues). * License: MIT * Get citation information for `geoops` in R doing `citation(package = 'geoops')` * Please note that this project is released with a [Contributor Code of Conduct][coc]. By participating in this project you agree to abide by its terms. [coc]: https://github.com/sckott/geoops/blob/main/CODE_OF_CONDUCT.md

Owner

  • Name: Scott Chamberlain
  • Login: sckott
  • Kind: user
  • Location: Oregon
  • Company: Fred Hutch Data Science Lab/Office of the Chief Data Officer

Software Engineer @ Fred Hutch

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "geoops",
  "description": "Tools for doing calculations and manipulations on 'GeoJSON', a 'geospatial' data interchange format (<https://tools.ietf.org/html/rfc7946>). 'GeoJSON' is also valid 'JSON'.",
  "name": "geoops: 'GeoJSON' Topology Calculations and Operations",
  "codeRepository": "https://github.com/sckott/geoops",
  "issueTracker": "https://github.com/sckott/geoops/issues",
  "license": "https://spdx.org/licenses/MIT",
  "version": "0.3.0.91",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.4.1 (2024-06-14)",
  "author": [
    {
      "@type": "Person",
      "givenName": "Scott",
      "familyName": "Chamberlain",
      "email": "myrmecocystus+r@gmail.com"
    }
  ],
  "copyrightHolder": [
    {
      "@type": "Person",
      "givenName": "Niels",
      "familyName": "Lohmann"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Scott",
      "familyName": "Chamberlain",
      "email": "myrmecocystus+r@gmail.com"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "roxygen2",
      "name": "roxygen2",
      "version": ">= 7.1.0",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=roxygen2"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=testthat"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "knitr",
      "name": "knitr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=knitr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "rmarkdown",
      "name": "rmarkdown",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rmarkdown"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "jsonlite",
      "name": "jsonlite",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=jsonlite"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "Rcpp",
      "name": "Rcpp",
      "version": ">= 0.12.12",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=Rcpp"
    },
    "SystemRequirements": "C++11"
  },
  "applicationCategory": "Geospatial",
  "keywords": [
    "geojson",
    "geospatial",
    "conversion",
    "data",
    "bbox",
    "coordinates",
    "distance",
    "bearing"
  ],
  "fileSize": "34182.956KB"
}

GitHub Events

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

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 145
  • Total Committers: 4
  • Avg Commits per committer: 36.25
  • Development Distribution Score (DDS): 0.028
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Scott Chamberlain m****s@g****m 141
Jeroen j****s@g****m 2
rOpenSci Bot m****t@g****m 1
Andy Teucher a****r@g****m 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 19
  • Total pull requests: 5
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 1 day
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 0.79
  • Average comments per pull request: 1.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • sckott (13)
  • ateucher (1)
Pull Request Authors
  • jeroen (3)
  • sckott (1)
  • ateucher (1)
Top Labels
Issue Labels
bug (2) docs (1)
Pull Request Labels

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/cache v1 composite
  • actions/checkout v1 composite
  • actions/upload-artifact master composite
  • r-lib/actions/setup-pandoc master composite
  • r-lib/actions/setup-r master composite
DESCRIPTION cran
  • Rcpp >= 0.12.12 imports
  • jsonlite * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • roxygen2 >= 7.1.0 suggests
  • testthat * suggests
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.5.0 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite