geotargets

Targets extensions for geospatial data

https://github.com/ropensci/geotargets

Science Score: 44.0%

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

  • CITATION.cff file
    Found 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 (21.8%) to scientific vocabulary

Keywords

geospatial pipeline r r-package r-targetopia raster reproducibility reproducible-research rstats targets vector workflow
Last synced: 6 months ago · JSON representation ·

Repository

Targets extensions for geospatial data

Basic Info
Statistics
  • Stars: 86
  • Watchers: 3
  • Forks: 6
  • Open Issues: 26
  • Releases: 4
Topics
geospatial pipeline r r-package r-targetopia raster reproducibility reproducible-research rstats targets vector workflow
Created almost 2 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog Contributing License Citation Codemeta

README.Rmd

---
output: github_document
---



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

# geotargets geotargets website 


[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![R Targetopia](https://img.shields.io/badge/R_Targetopia-member-blue?style=flat&labelColor=gray)](https://wlandau.github.io/targetopia/)
[![R-CMD-check](https://github.com/ropensci/geotargets/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/geotargets/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/ropensci/geotargets/branch/master/graph/badge.svg)](https://app.codecov.io/gh/ropensci/geotargets?branch=master)
[![pkgcheck](https://github.com/ropensci/geotargets/workflows/pkgcheck/badge.svg)](https://github.com/ropensci/geotargets/actions?query=workflow%3Apkgcheck)
[![Status at rOpenSci Software Peer Review](https://badges.ropensci.org/675_status.svg)](https://github.com/ropensci/software-review/issues/675)


`geotargets` extends [`targets`](https://github.com/ropensci/targets) to work with geospatial data formats, such as rasters and vectors (e.g., shapefiles). Currently we support raster and vector formats for the [`terra`](https://github.com/rspatial/terra) package. 

If you are unfamiliar with targets, we recommend watching ["targets in 4 minutes"](https://docs.ropensci.org/targets/#get-started-in-4-minutes).

## How to cite geotargets

One example citation of geotargets could be as follows: "R packages used in this analysis included (list R packages used), targets, and geotargets (Tierney, N., Scott, E., & Brown, A, 2024). Here is the full bibliographic reference for your references:

> Tierney N, Scott E, Brown A
  (2024). "geotargets: 'Targets'
  Extensions for Geospatial
  Formats."
  .

## Installation

You can install the development version of geotargets like so:

``` r
install.packages("geotargets", repos = c("https://ropensci.r-universe.dev", "https://cran.r-project.org"))
```

## Why `geotargets`

If you want to use geospatial data formats (such as `terra`) with the [`targets`](https://github.com/ropensci/targets) package to build analytic reproducible pipelines, it involves writing a lot of custom targets wrappers. We wrote `geotargets` so you can use geospatial data formats with `targets`.

To provide more detail on this, a common problem when using popular libraries like `terra` with `targets` is running into errors with read and write. Due to the limitations that come with the underlying C++ implementation in the `terra` library, there are specific ways to write and read these objects. See `?terra` for details. `geotargets` helps handle these write and read steps, so you don't have to worry about them and can use targets as you are used to.

In essence, if you've ever come across the error:

```
Error in .External(list(name = "CppMethod__invoke_notvoid", address = ,  : 
  NULL value passed as symbol address
```

or 

```
Error: external pointer is not valid
```

When trying to read in a geospatial raster or vector in targets, then `geotargets` for you :)

# Examples

We currently provide support for the `terra` package with `targets`. Below we show three examples of target factories:

- `tar_terra_rast()`
- `tar_terra_vect()`
- `tar_terra_sprc()`
- `tar_terra_sds()`
- `tar_terra_tiles()`
- `tar_stars()`

You would use these in place of `tar_target()` in your targets pipeline, e.g., when you are doing work with `terra` raster, vector, or raster collection data.

If you would like to see and download working examples for yourself, see the repos: 

- [demo-geotargets](https://github.com/njtierney/demo-geotargets)
- [icebreaker](https://github.com/njtierney/icebreaker)

## `tar_terra_rast()`: targets with terra rasters

```{r}
#| label: tar-terra-rast
library(targets)

tar_dir({ # tar_dir() runs code from a temporary directory.
  tar_script({
    library(geotargets)

    get_elev <- function() {
      terra::rast(system.file("ex", "elev.tif", package = "terra"))
    }

    list(
      tar_terra_rast(
        terra_rast_example,
        get_elev()
      )
    )
  })

  tar_make()
  x <- tar_read(terra_rast_example)
  x
})
```


## `tar_terra_vect()`: targets with terra vectors

```{r}
#| label: tar-terra-vect
tar_dir({ # tar_dir() runs code from a temporary directory.
  tar_script({
    library(geotargets)

    lux_area <- function(projection = "EPSG:4326") {
      terra::project(
        terra::vect(system.file("ex", "lux.shp",
          package = "terra"
        )),
        projection
      )
    }

    list(
      tar_terra_vect(
        terra_vect_example,
        lux_area()
      )
    )
  })

  tar_make()
  x <- tar_read(terra_vect_example)
  x
})
```


## `tar_terra_sprc()`: targets with terra raster collections

```{r}
#| label: tar-terra-sprc
tar_dir({ # tar_dir() runs code from a temporary directory.
  tar_script({
    library(geotargets)

    elev_scale <- function(z = 1, projection = "EPSG:4326") {
      terra::project(
        terra::rast(system.file("ex", "elev.tif", package = "terra")) * z,
        projection
      )
    }

    list(
      tar_terra_sprc(
        raster_elevs,
        # two rasters, one unaltered, one scaled by factor of 2 and
        # reprojected to interrupted goode homolosine
        command = terra::sprc(list(
          elev_scale(1),
          elev_scale(2, "+proj=igh")
        ))
      )
    )
  })

  tar_make()
  x <- tar_read(raster_elevs)
  x
})
```



## `tar_stars()`: targets with stars objects

```{r}
#| label: tar-stars
tar_dir({ # tar_dir() runs code from a temporary directory.
  tar_script({
    library(geotargets)

    list(
      tar_stars(
        test_stars,
        stars::read_stars(system.file("tif", "olinda_dem_utm25s.tif", package = "stars"))
      )
    )
  })

  tar_make()
  x <- tar_read(test_stars)
  x
})
```


## Code of Conduct

Please note that the geotargets project is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms.

## Acknowledgements

Logo design by Hubert Hałun at Appsilon.

Owner

  • Name: rOpenSci
  • Login: ropensci
  • Kind: organization
  • Email: info@ropensci.org
  • Location: Berkeley, CA

Citation (CITATION.cff)

# --------------------------------------------
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# --------------------------------------------
 
cff-version: 1.2.0
message: 'To cite package "geotargets" in publications use:'
type: software
license: MIT
title: 'geotargets: ''targets'' Extensions for Geographic Spatial Formats'
version: 0.3.1
identifiers:
- type: doi
  value: 10.32614/CRAN.package.geotargets
abstract: Provides extensions for various geographic spatial file formats, such as
  shape files and rasters. Currently provides support for the 'terra' geographic spatial
  formats. See the vignettes for worked examples, demonstrations, and explanations
  of how to use the various package extensions.
authors:
- family-names: Tierney
  given-names: Nicholas
  email: nicholas.tierney@gmail.com
  orcid: https://orcid.org/0000-0003-1460-8722
- family-names: Scott
  given-names: Eric
  orcid: https://orcid.org/0000-0002-7430-7879
- family-names: Brown
  given-names: Andrew
  orcid: https://orcid.org/0000-0002-4565-533X
preferred-citation:
  type: generic
  title: 'geotargets: ''Targets'' Extensions for Geospatial Formats'
  authors:
  - family-names: Tierney
    given-names: Nicholas
    email: nicholas.tierney@gmail.com
    orcid: https://orcid.org/0000-0003-1460-8722
  - family-names: Scott
    given-names: Eric
    orcid: https://orcid.org/0000-0002-7430-7879
  - family-names: Brown
    given-names: Andrew
    orcid: https://orcid.org/0000-0002-4565-533X
  year: '2024'
  url: https://docs.ropensci.org/geotargets/
  abstract: Provides extensions for various geospatial file formats, such as shapefiles
    and rasters. Currently provides support for the 'terra' geospatial formats. See
    the vignettes for worked examples, demonstrations, and explanations of how to
    use the various package extensions.
  keywords:
  - geospatial
  - pipeline
  - r
  - r-package
  - r-targetopia
  - raster
  - reproducibility
  - reproducible-research
  - rstats
  - targets
  - vector
  - workflow
  version: 0.3.0
repository: https://CRAN.R-project.org/package=geotargets
repository-code: https://github.com/ropensci/geotargets
url: https://docs.ropensci.org/geotargets/
contact:
- family-names: Tierney
  given-names: Nicholas
  email: nicholas.tierney@gmail.com
  orcid: https://orcid.org/0000-0003-1460-8722
keywords:
- geospatial
- pipeline
- r
- r-package
- r-targetopia
- raster
- reproducibility
- reproducible-research
- rstats
- targets
- vector
- workflow

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "geotargets",
  "description": "Provides extensions for various geographic spatial file formats, such as shape files and rasters. Currently provides support for the 'terra' geographic spatial formats. See the vignettes for worked examples, demonstrations, and explanations of how to use the various package extensions.",
  "name": "geotargets: 'targets' Extensions for Geographic Spatial Formats",
  "relatedLink": "https://docs.ropensci.org/geotargets/",
  "codeRepository": "https://github.com/ropensci/geotargets",
  "issueTracker": "https://github.com/ropensci/geotargets/issues",
  "license": "https://spdx.org/licenses/MIT",
  "version": "0.3.1",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.5.0 (2025-04-11)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Nicholas",
      "familyName": "Tierney",
      "email": "nicholas.tierney@gmail.com",
      "@id": "https://orcid.org/0000-0003-1460-8722"
    },
    {
      "@type": "Person",
      "givenName": "Eric",
      "familyName": "Scott",
      "@id": "https://orcid.org/0000-0002-7430-7879"
    },
    {
      "@type": "Person",
      "givenName": "Andrew",
      "familyName": "Brown",
      "@id": "https://orcid.org/0000-0002-4565-533X"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Nicholas",
      "familyName": "Tierney",
      "email": "nicholas.tierney@gmail.com",
      "@id": "https://orcid.org/0000-0003-1460-8722"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "crew",
      "name": "crew",
      "version": ">= 0.9.2",
      "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=crew"
    },
    {
      "@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": "ncmeta",
      "name": "ncmeta",
      "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=ncmeta"
    },
    {
      "@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": "sf",
      "name": "sf",
      "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=sf"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "stars",
      "name": "stars",
      "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=stars"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "version": ">= 3.0.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=testthat"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "fs",
      "name": "fs",
      "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=fs"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "spelling",
      "name": "spelling",
      "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=spelling"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 4.1.0"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "targets",
      "name": "targets",
      "version": ">= 1.8.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=targets"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "rlang",
      "name": "rlang",
      "version": ">= 1.1.3",
      "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=rlang"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "cli",
      "name": "cli",
      "version": ">= 3.6.2",
      "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=cli"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "terra",
      "name": "terra",
      "version": ">= 1.8-10",
      "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=terra"
    },
    "6": {
      "@type": "SoftwareApplication",
      "identifier": "withr",
      "name": "withr",
      "version": ">= 3.0.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=withr"
    },
    "7": {
      "@type": "SoftwareApplication",
      "identifier": "zip",
      "name": "zip",
      "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=zip"
    },
    "8": {
      "@type": "SoftwareApplication",
      "identifier": "lifecycle",
      "name": "lifecycle",
      "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=lifecycle"
    },
    "9": {
      "@type": "SoftwareApplication",
      "identifier": "gdalraster",
      "name": "gdalraster",
      "version": ">= 2.0.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=gdalraster"
    },
    "SystemRequirements": null
  },
  "fileSize": "327.4KB",
  "citation": [
    {
      "@type": "CreativeWork",
      "datePublished": "2024",
      "author": [
        {
          "@type": "Person",
          "givenName": "Nicholas",
          "familyName": "Tierney",
          "email": "nicholas.tierney@gmail.com",
          "@id": "https://orcid.org/0000-0003-1460-8722"
        },
        {
          "@type": "Person",
          "givenName": "Eric",
          "familyName": "Scott",
          "@id": "https://orcid.org/0000-0002-7430-7879"
        },
        {
          "@type": "Person",
          "givenName": "Andrew",
          "familyName": "Brown",
          "@id": "https://orcid.org/0000-0002-4565-533X"
        }
      ],
      "name": "geotargets: 'Targets' Extensions for Geospatial Formats",
      "url": "https://docs.ropensci.org/geotargets/"
    }
  ],
  "releaseNotes": "https://github.com/ropensci/geotargets/blob/master/NEWS.md",
  "readme": "https://github.com/ropensci/geotargets/blob/main/README.md",
  "contIntegration": [
    "https://github.com/ropensci/geotargets/actions/workflows/R-CMD-check.yaml",
    "https://app.codecov.io/gh/ropensci/geotargets?branch=master",
    "https://github.com/ropensci/geotargets/actions?query=workflow%3Apkgcheck"
  ],
  "developmentStatus": "https://www.repostatus.org/#active",
  "review": {
    "@type": "Review",
    "url": "https://github.com/ropensci/software-review/issues/675",
    "provider": "https://ropensci.org"
  },
  "keywords": [
    "geospatial",
    "pipeline",
    "r",
    "r-package",
    "r-targetopia",
    "raster",
    "reproducibility",
    "reproducible-research",
    "rstats",
    "targets",
    "vector",
    "workflow"
  ]
}

GitHub Events

Total
  • Create event: 7
  • Release event: 2
  • Issues event: 24
  • Watch event: 14
  • Delete event: 3
  • Issue comment event: 88
  • Push event: 38
  • Pull request review event: 10
  • Pull request review comment event: 3
  • Pull request event: 18
  • Fork event: 3
Last Year
  • Create event: 7
  • Release event: 2
  • Issues event: 24
  • Watch event: 14
  • Delete event: 3
  • Issue comment event: 88
  • Push event: 38
  • Pull request review event: 10
  • Pull request review comment event: 3
  • Pull request event: 18
  • Fork event: 3

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 438
  • Total Committers: 6
  • Avg Commits per committer: 73.0
  • Development Distribution Score (DDS): 0.495
Past Year
  • Commits: 254
  • Committers: 5
  • Avg Commits per committer: 50.8
  • Development Distribution Score (DDS): 0.48
Top Committers
Name Email Commits
Eric Scott s****r@g****m 221
njtierney n****y@g****m 127
Andrew Gene Brown b****g@g****m 87
RichardScottOZ R****t@o****m 1
Eric Robsky Huntley e****y@p****e 1
Nicholas Tierney n****t@N****l 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 104
  • Total pull requests: 68
  • Average time to close issues: about 2 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 9
  • Total pull request authors: 6
  • Average comments per issue: 3.07
  • Average comments per pull request: 2.41
  • Merged pull requests: 61
  • Bot issues: 2
  • Bot pull requests: 0
Past Year
  • Issues: 39
  • Pull requests: 26
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 27 days
  • Issue authors: 8
  • Pull request authors: 4
  • Average comments per issue: 3.08
  • Average comments per pull request: 2.92
  • Merged pull requests: 24
  • Bot issues: 2
  • Bot pull requests: 0
Top Authors
Issue Authors
  • njtierney (31)
  • Aariq (26)
  • brownag (8)
  • geryan (3)
  • ratnanil (1)
  • tjstagni (1)
  • rsbravoh (1)
  • JsLth (1)
  • PMassicotte (1)
  • github-actions[bot] (1)
Pull Request Authors
  • Aariq (25)
  • brownag (18)
  • njtierney (6)
  • ctoney (2)
  • ericrobskyhuntley (2)
  • RichardScottOZ (1)
Top Labels
Issue Labels
priority: low (6) bug (6) terra (6) priority: high (5) priority: medium (5) new package (2) question (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 505 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: geotargets

'targets' Extensions for Geographic Spatial Formats

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 505 Last month
Rankings
Dependent packages count: 26.6%
Dependent repos count: 32.8%
Average: 48.7%
Downloads: 86.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/action.yaml actions
  • actions/upload-artifact v4 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • targets * imports
  • terra * imports
  • utils * imports
  • testthat >= 3.0.0 suggests