Skip to content

Commit dcda1fd

Browse files
committed
Merge branch 'main' into pointx
2 parents f96e0fa + 10219fe commit dcda1fd

File tree

22 files changed

+238
-232
lines changed

22 files changed

+238
-232
lines changed

.github/workflows/pkgdown.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
release:
9+
types: [published]
10+
workflow_dispatch:
11+
12+
name: pkgdown
13+
14+
jobs:
15+
pkgdown:
16+
runs-on: ubuntu-latest
17+
# Only restrict concurrency for non-PR jobs
18+
concurrency:
19+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
20+
env:
21+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- uses: r-lib/actions/setup-pandoc@v2
26+
27+
- uses: r-lib/actions/setup-r@v2
28+
with:
29+
use-public-rspm: true
30+
31+
- uses: r-lib/actions/setup-r-dependencies@v2
32+
with:
33+
extra-packages: any::pkgdown, local::.
34+
needs: website
35+
36+
- name: Build site
37+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
38+
shell: Rscript {0}
39+
40+
- name: Deploy to GitHub pages 🚀
41+
if: github.event_name != 'pull_request'
42+
uses: JamesIves/github-pages-deploy-action@v4.4.1
43+
with:
44+
clean: false
45+
branch: gh-pages
46+
folder: docs

.github/workflows/rcmdcheck.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
name: R-CMD-check
10+
11+
jobs:
12+
R-CMD-check:
13+
runs-on: ${{ matrix.config.os }}
14+
15+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
config:
21+
- {os: macos-latest, r: 'release'}
22+
- {os: windows-latest, r: 'release'}
23+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
24+
- {os: ubuntu-latest, r: 'release'}
25+
26+
env:
27+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
28+
R_KEEP_PKG_SOURCE: yes
29+
30+
steps:
31+
- uses: actions/checkout@v3
32+
33+
- uses: r-lib/actions/setup-pandoc@v2
34+
35+
- uses: r-lib/actions/setup-r@v2
36+
with:
37+
rtools-version: '42'
38+
r-version: ${{ matrix.config.r }}
39+
http-user-agent: ${{ matrix.config.http-user-agent }}
40+
use-public-rspm: true
41+
42+
- name: Install macOS system dependencies
43+
if: runner.os == 'macOS'
44+
run: brew install gdal proj
45+
46+
- uses: r-lib/actions/setup-r-dependencies@v2
47+
with:
48+
extra-packages: any::rcmdcheck
49+
needs: check
50+
51+
- uses: r-lib/actions/check-r-package@v2
52+
with:
53+
upload-snapshots: true

.github/workflows/tic.yml

Lines changed: 0 additions & 155 deletions
This file was deleted.

.github/workflows/update-tic.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ S3method(c,sfc)
3030
S3method(c,sfg)
3131
S3method(cbind,sf)
3232
S3method(dim,sgbp)
33+
S3method(duplicated,sf)
3334
S3method(format,bbox)
3435
S3method(format,crs)
3536
S3method(format,sfc)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# version 1.0-13
22

3+
* use GEOS' overlayNG routines for (GEOS) Intersection, Difference, Union and SymDifference; #2143
4+
5+
* added `duplicated.sf()`; #2138, #2140, thanks to @bart1
6+
37
* `select.sf()` allows selecting the same column twice under different names; #1886
48

59
* `st_as_sf.ppplist()` is deprecated; #1926

R/agr.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ st_set_agr = function(x, value) {
8686

8787
summarize_agr = function(x) {
8888
su = summary(st_agr(x))
89-
paste(paste(su, names(su)), collapse = ", ")
89+
su = su[su > 0]
90+
paste(paste0(names(su), " (", su, ")"), collapse = ", ")
9091
}
9192

9293
all_constant = function(x) {

R/cast_sfc.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,21 @@ empty_sfg <- function(to) {
155155
#' @export
156156
#' @return In case \code{to} is missing, \code{st_cast.sfc} will coerce combinations of "POINT" and "MULTIPOINT", "LINESTRING" and "MULTILINESTRING", "POLYGON" and "MULTIPOLYGON" into their "MULTI..." form, or in case all geometries are "GEOMETRYCOLLECTION" will return a list of all the contents of the "GEOMETRYCOLLECTION" objects, or else do nothing. In case \code{to} is specified, if \code{to} is "GEOMETRY", geometries are not converted, else, \code{st_cast} will try to coerce all elements into \code{to}; \code{ids} may be specified to group e.g. "POINT" objects into a "MULTIPOINT", if not specified no grouping takes place. If e.g. a "sfc_MULTIPOINT" is cast to a "sfc_POINT", the objects are split, so no information gets lost, unless \code{group_or_split} is \code{FALSE}.
157157
#' @details When converting a GEOMETRYCOLLECTION to COMPOUNDCURVE, MULTISURFACE or CURVEPOLYGON, the user is responsible for the validity of the resulting object: no checks are being carried out by the software.
158-
#'
158+
#'
159+
#' When converting mixed, GEOMETRY sets, it may help to first convert to the MULTI-type, see examples
160+
#' @examples
161+
#' # https://github.com/r-spatial/sf/issues/1930:
162+
#' pt1 <- st_point(c(0,1))
163+
#' pt23 <- st_multipoint(matrix(c(1,2,3,4), ncol = 2, byrow = TRUE))
164+
#' d <- st_sf(geom = st_sfc(pt1, pt23))
165+
#' st_cast(d, "POINT") # will not convert the entire MULTIPOINT, and warns
166+
#' st_cast(d, "MULTIPOINT") %>% st_cast("POINT")
159167
st_cast.sfc = function(x, to, ..., ids = seq_along(x), group_or_split = TRUE) {
160168
if (missing(to))
161169
return(st_cast_sfc_default(x))
162170

163171
e = rep(FALSE, length(x))
164-
if (!inherits(x, c("sfc_MULTICURVE", "sfc_COMPOUNDCURVE"))) {
172+
if (!inherits(x, c("sfc_MULTICURVE", "sfc_COMPOUNDCURVE", "sfc_CURVEPOLYGON"))) { # for which GEOS has no st_is_empty()
165173
e = st_is_empty(x)
166174
if (all(e)) {
167175
x[e] = empty_sfg(to)

R/plot.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
#' When setting \code{reset} to \code{FALSE}, the original device parameters are lost, and the device must be reset using \code{dev.off()} in order to reset it.
4242
#'
4343
#' parameter \code{at} can be set to specify where labels are placed along the key; see examples.
44+
#'
45+
#' The features are plotted in the order as they apppear in the sf object. See examples for when a different plotting order is wanted.
4446
#'
4547
#' @examples
4648
#' nc = st_read(system.file("gpkg/nc.gpkg", package="sf"), quiet = TRUE)
@@ -62,6 +64,11 @@
6264
#' layout(matrix(1:2, ncol = 2), widths = c(1, lcm(2)))
6365
#' plot(1)
6466
#' .image_scale(1:10, col = sf.colors(9), key.length = lcm(8), key.pos = 4, at = 1:10)
67+
#' # manipulate plotting order, plot largest polygons first:
68+
#' p = st_polygon(list(rbind(c(0,0), c(1,0), c(1,1), c(0,1), c(0,0))))
69+
#' x = st_sf(a=1:4, st_sfc(p, p * 2, p * 3, p * 4)) # plot(x, col=2:5) only shows the largest polygon!
70+
#' plot(x[order(st_area(x), decreasing = TRUE),], col = 2:5) # plot largest polygons first
71+
#'
6572
#' @export
6673
plot.sf <- function(x, y, ..., main, pal = NULL, nbreaks = 10, breaks = "pretty",
6774
max.plot = if(is.null(n <- getOption("sf_max.plot"))) 9 else n,

R/sample.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ st_sample = function(x, size, ...) UseMethod("st_sample")
3535
#'
3636
#' Fibonacci sampling see: Alvaro Gonzalez, 2010. Measurement of Areas on a Sphere Using Fibonacci and Latitude-Longitude Lattices.
3737
#' Mathematical Geosciences 42(1), p. 49-64
38+
#'
39+
#' For regular sampling on the sphere, see also \code{geosphere::regularCoordinates}.
3840
#'
3941
#' Sampling methods from package \code{spatstat} are interfaced (see examples), and need their own parameters to be set.
4042
#' For instance, to use \code{spatstat.random::rThomas()}, set \code{type = "Thomas"}.

0 commit comments

Comments
 (0)