sfext
✂️🌐 A R package with extra options for simple features and spatial data
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 (21.3%) to scientific vocabulary
Keywords
r
r-package
rspatial
rstats
sf
Last synced: 4 months ago
·
JSON representation
Repository
✂️🌐 A R package with extra options for simple features and spatial data
Basic Info
- Host: GitHub
- Owner: elipousson
- License: other
- Language: R
- Default Branch: main
- Homepage: https://elipousson.github.io/sfext/
- Size: 22.3 MB
Statistics
- Stars: 20
- Watchers: 2
- Forks: 1
- Open Issues: 2
- Releases: 0
Topics
r
r-package
rspatial
rstats
sf
Created over 3 years ago
· Last pushed about 1 year ago
Metadata Files
Readme
Changelog
License
Codemeta
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# sfext
[](https://CRAN.R-project.org/package=sfext)
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://opensource.org/licenses/MIT)
[](https://app.codecov.io/gh/elipousson/sfext?branch=main)
[](https://www.repostatus.org/#active)
The goal of sfext is to extend existing functions from the [{sf} package](https://r-spatial.github.io/sf/) and offer a range of additional options for working with simple feature objects, bounding boxes, and data frame objects with coordinates or other spatial information.
## Installation
You can install the development version of sfext like so:
``` r
# pak::pkg_install("elipousson/sfext")
```
## Usage
```{r setup}
library(sfext)
```
### Extending existing {sf} functions
`{sfext}` is built around existing sf functions but designed to offer greater flexibility around both inputs and outputs. For example, `read_sf_ext()` is a wrapper for `sf::read_sf()` and offers a similar functionality:
```{r}
nc <- read_sf_ext(system.file("shape/nc.shp", package = "sf"))
```
However, `read_sf_ext()` also supports URLs for Google Sheets, FeatureLayers, data included with an installed package, and a variety of other sources. The function also supports an optional bounding box filter.
```{r}
read_sf_ext("https://carto.nationalmap.gov/arcgis/rest/services/govunits/MapServer/29", bbox = as_bbox(nc))
```
`st_union_ext()` is nearly identical to `sf::st_union()` but optionally preserve a name column (collapsing the values of that column into a single string):
```{r}
random_id <- sample(nrow(nc), size = 8)
nc_union <- st_union_ext(nc[random_id, ], name_col = "NAME")
plot(
nc_union
)
```
`st_buffer_ext()` wraps `sf::st_buffer()` but accepts bounding box objects as an input, allows you to set the units for the buffer distance using a character string (automatically converts the buffer distance units to match the units of the input object):
```{r}
# Apply a 20 mile buffer to the unioned geometry
plot(
st_buffer_ext(nc_union, dist = 20, unit = "mi")
)
```
`st_make_grid_ext()` wraps `sf::st_make_grid()` but makes it easy to set the dimensions of the grid using rows, columns, and an overall aspect ratio:
```{r}
# Make a 5 by 5 grid with a 8.5 by 11 aspect ratio filtered to x
plot(
st_make_grid_ext(
x = nc,
asp = 11 / 8.5,
ncol = 5,
nrow = 5,
filter = TRUE
)
)
```
Most functions that include a `crs` parameter can convert the coordinate reference system of the output (using `transform_sf()` or `sf_bbox_transform()`). The crs parameter also supports sf, sfc, or bbox inputs. Functions that include a `class` parameter can convert the class of an object using `as_sf_class()`. There are a set of functions for class conversion that typically wrap multiple sf functions with more limited input options.
```{r}
nc_bbox <- as_bbox(nc, crs = 4326)
nc_bbox
as_sfc(nc[1, ], crs = 3857)
as_sf(nc_bbox, crs = nc)
```
Please note this flexibility make `{sfext}` easy to use (especially in an interactive context) but likely *not* appropriate for reproducible research. The package is being actively developed and the API may change.
### Additional helper functions for `sf` objects
sfext also includes several helper functions that add new features by combining functions from the {sf} package, using [affine geometry](https://r-spatial.github.io/sf/articles/sf3.html#affine-transformations), or adding features from other packages.
For example, `st_edge()` combines `sf::st_buffer()` and `sf::st_difference()` to get the "edges" of any geometry.
```{r}
plot(
st_edge(nc, dist = 10, unit = "mi"),
max.plot = 1
)
```
`st_nudge()` allows you to shift the position of an `sf` object to a new location:
```{r}
nc_nudge <- st_nudge(nc, to = nc[1, ])
plot(
st_union_ext(
nc,
nc_nudge
),
max.plot = 1
)
```
`st_donut()` allows you to create donuts around existing features:
```{r}
plot(
st_donut(nc[c(1, 2, 3), ])
)
```
Lastly, the package has a whole group of helper functions for bbox objects. For example, `sf_bbox_corners()` creates a sf object with POINT geometry based on the corners of a bounding box:
```{r}
plot(
sf_bbox_corners(
as_bbox(nc)
)
)
```
## Related projects
`{sfext}` *depends* on two other development packages:
- [{papersize}](https://elipousson.github.io/papersize/): A collection of convenience functions extending grid, ggplot2, and patchwork to help in sizing plots and files for printing to paper, postcards, playing cards, and other physical media.
- [{filenamr}](https://elipousson.github.io/filenamr/): A package to help create and modify file names and paths (that also supports reading and writing EXIF metadata).
It is also *used* extensively by two other development packages:
- [{getdata}](https://elipousson.github.io/getdata/): A package to make the experience of getting location data easier and more consistent across a wide variety of sources.
- [{maplayer}](https://elipousson.github.io/maplayer/): A consistent set of functions for creating map layers for [{ggplot2}](https://ggplot2.tidyverse.org/) using simple feature data.
There are *many* packages that build on sf for a variety of specialized use cases. A few worth noting include:
- [{sfdep}](https://github.com/JosiahParry/sfdep): A sf and tidyverse friendly interface to the spdep package for spatial dependence.
- [{sfnetworks}](https://github.com/luukvdmeer/sfnetworks): Tidy Geospatial Networks in R.
- [{sfhotspot}](https://github.com/mpjashby/sfhotspot): A set of functions to identify and understand clusters of points (typically representing the locations of places or events).
- [{sfx}](https://seasmith.github.io/packages/sfx/): Extra ‘sf’ Simple Features manipulations.
Owner
- Name: Eli Pousson
- Login: elipousson
- Kind: user
- Location: Baltimore, MD
- Company: Baltimore City Department of Planning
- Website: https://elipousson.github.io/
- Twitter: elipousson
- Repositories: 95
- Profile: https://github.com/elipousson
I love old buildings and bicycles. Planner with the Baltimore City Department of Planning. Former preservationist @baltimoreheritage
CodeMeta (codemeta.json)
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"identifier": "sfext",
"description": "Extra functions with additional options for reading, writing, and transforming spatial data. Includes a variety of utility functions for working with tabular data with coordinates and distance and area units.",
"name": "sfext: Extra Functions for Simple Feature Data",
"relatedLink": "https://elipousson.github.io/sfext/",
"codeRepository": "https://github.com/elipousson/sfext",
"issueTracker": "https://github.com/elipousson/sfext/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.1.1",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.2.3 (2023-03-15)",
"author": [
{
"@type": "Person",
"givenName": "Eli",
"familyName": "Pousson",
"email": "eli.pousson@gmail.com",
"@id": "https://orcid.org/0000-0001-8280-1706"
}
],
"copyrightHolder": [
{
"@type": "Person",
"givenName": "Eli",
"familyName": "Pousson",
"email": "eli.pousson@gmail.com",
"@id": "https://orcid.org/0000-0001-8280-1706"
}
],
"maintainer": [
{
"@type": "Person",
"givenName": "Eli",
"familyName": "Pousson",
"email": "eli.pousson@gmail.com",
"@id": "https://orcid.org/0000-0001-8280-1706"
}
],
"softwareSuggestions": [
{
"@type": "SoftwareApplication",
"identifier": "covr",
"name": "covr",
"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=covr"
},
{
"@type": "SoftwareApplication",
"identifier": "esri2sf",
"name": "esri2sf",
"version": ">= 0.1.1",
"sameAs": "https://github.com/elipousson/esri2sf"
},
{
"@type": "SoftwareApplication",
"identifier": "exiftoolr",
"name": "exiftoolr",
"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=exiftoolr"
},
{
"@type": "SoftwareApplication",
"identifier": "geosphere",
"name": "geosphere",
"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=geosphere"
},
{
"@type": "SoftwareApplication",
"identifier": "ggplot2",
"name": "ggplot2",
"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=ggplot2"
},
{
"@type": "SoftwareApplication",
"identifier": "gistr",
"name": "gistr",
"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=gistr"
},
{
"@type": "SoftwareApplication",
"identifier": "googlesheets4",
"name": "googlesheets4",
"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=googlesheets4"
},
{
"@type": "SoftwareApplication",
"identifier": "httr2",
"name": "httr2",
"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=httr2"
},
{
"@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": "lwgeom",
"name": "lwgeom",
"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=lwgeom"
},
{
"@type": "SoftwareApplication",
"identifier": "naniar",
"name": "naniar",
"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=naniar"
},
{
"@type": "SoftwareApplication",
"identifier": "openxlsx",
"name": "openxlsx",
"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=openxlsx"
},
{
"@type": "SoftwareApplication",
"identifier": "osmdata",
"name": "osmdata",
"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=osmdata"
},
{
"@type": "SoftwareApplication",
"identifier": "rappdirs",
"name": "rappdirs",
"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=rappdirs"
},
{
"@type": "SoftwareApplication",
"identifier": "readr",
"name": "readr",
"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=readr"
},
{
"@type": "SoftwareApplication",
"identifier": "readxl",
"name": "readxl",
"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=readxl"
},
{
"@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": "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": "tidygeocoder",
"name": "tidygeocoder",
"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=tidygeocoder"
},
{
"@type": "SoftwareApplication",
"identifier": "tidyr",
"name": "tidyr",
"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=tidyr"
},
{
"@type": "SoftwareApplication",
"identifier": "withr",
"name": "withr",
"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"
}
],
"softwareRequirements": {
"1": {
"@type": "SoftwareApplication",
"identifier": "R",
"name": "R",
"version": ">= 2.10"
},
"2": {
"@type": "SoftwareApplication",
"identifier": "cli",
"name": "cli",
"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"
},
"3": {
"@type": "SoftwareApplication",
"identifier": "cliExtras",
"name": "cliExtras",
"version": ">= 0.1.0",
"sameAs": "https://github.com/elipousson/cliExtras"
},
"4": {
"@type": "SoftwareApplication",
"identifier": "dplyr",
"name": "dplyr",
"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=dplyr"
},
"5": {
"@type": "SoftwareApplication",
"identifier": "filenamr",
"name": "filenamr",
"version": ">= 0.1.0.9002",
"sameAs": "https://github.com/elipousson/filenamr"
},
"6": {
"@type": "SoftwareApplication",
"identifier": "glue",
"name": "glue",
"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=glue"
},
"7": {
"@type": "SoftwareApplication",
"identifier": "janitor",
"name": "janitor",
"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=janitor"
},
"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": "purrr",
"name": "purrr",
"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=purrr"
},
"10": {
"@type": "SoftwareApplication",
"identifier": "rlang",
"name": "rlang",
"version": ">= 1.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=rlang"
},
"11": {
"@type": "SoftwareApplication",
"identifier": "sf",
"name": "sf",
"version": ">= 1.0-11",
"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"
},
"12": {
"@type": "SoftwareApplication",
"identifier": "tibble",
"name": "tibble",
"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=tibble"
},
"13": {
"@type": "SoftwareApplication",
"identifier": "units",
"name": "units",
"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=units"
},
"14": {
"@type": "SoftwareApplication",
"identifier": "vctrs",
"name": "vctrs",
"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=vctrs"
},
"SystemRequirements": null
},
"fileSize": "851.315KB",
"releaseNotes": "https://github.com/elipousson/sfext/blob/master/NEWS.md",
"readme": "https://github.com/elipousson/sfext/blob/main/README.md",
"contIntegration": "https://app.codecov.io/gh/elipousson/sfext?branch=main",
"developmentStatus": [
"https://lifecycle.r-lib.org/articles/stages.html#experimental",
"https://www.repostatus.org/#active"
],
"keywords": [
"r",
"rspatial",
"sf",
"r-package",
"rstats"
]
}
GitHub Events
Total
- Watch event: 1
- Push event: 4
Last Year
- Watch event: 1
- Push event: 4
Committers
Last synced: 6 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Eli Pousson | e****n@g****m | 592 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 5
- Total pull requests: 0
- Average time to close issues: 4 months
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 0.4
- Average comments per pull request: 0
- Merged pull requests: 0
- 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
- elipousson (5)
Pull Request Authors
Top Labels
Issue Labels
bug (1)
Pull Request Labels
Dependencies
DESCRIPTION
cran
- R >= 2.10 depends
- cli * imports
- dplyr * imports
- glue * imports
- janitor * imports
- purrr * imports
- rlang * imports
- sf * imports
- stringr * imports
- tibble * imports
- tidyr * imports
- units * imports
- covr * suggests
- esri2sf >= 0.1.1 suggests
- exiftoolr * suggests
- geosphere * suggests
- ggplot2 * suggests
- gistr * suggests
- googlesheets4 * suggests
- httr2 * suggests
- knitr * suggests
- lwgeom * suggests
- naniar * suggests
- openxlsx * suggests
- rappdirs * suggests
- readr * suggests
- readxl * suggests
- rmarkdown * suggests
- testthat >= 3.0.0 suggests
- tidygeocoder * suggests
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 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/test-coverage.yaml
actions
- actions/checkout v3 composite
- actions/upload-artifact v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite