Skip to content

Commit 9073a52

Browse files
committed
Merge branch 'main' of github.com:r-spatial/sf
2 parents 6cac2e2 + 2f38044 commit 9073a52

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+226
-202
lines changed

NEWS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
* `[.sfc` works when setting argument `op`; #2320
44

5-
* `st_sample` for polygons is sensitive to setting `oriented = TRUE` to prevent wrongly correcting ring directions; #2308
5+
* `st_sample()` for polygons is sensitive to setting `oriented = TRUE` to prevent wrongly correcting ring directions; #2308
66

77
* add support for the GDAL `footprint` utility (requiring GDAL >= 3.8.0) to `gdal_utils`; #2305, by @goergen95
88

@@ -42,9 +42,9 @@
4242

4343
* if the env. variable `ADD_SF_NAMESPACE` is set to `true`, `sf` objects get a new attribute, `.sf_namespace`, which forces loading the `sf` namespace when it has not been loaded so far, e.g. for proper printing or plotting of an `sf` object; #2212 by Mike Mahoney
4444

45-
* `distinct.sf` is type-safe for `sf` objects with zero rows; #2204
45+
* `distinct.sf()` is type-safe for `sf` objects with zero rows; #2204
4646

47-
* `summarise.sf` raises an error if `.by` is given but no `across()` on the geometry; #2207
47+
* `summarise.sf()` raises an error if `.by` is given but no `across()` on the geometry; #2207
4848

4949
* `st_write()` matches fields on name first, than on position; this matters for formats that have pre-defined names, such as GPX; #2202
5050

@@ -152,7 +152,7 @@
152152

153153
* `sf_project()` accepts 3- or 4-column matrices, containing z and t values;
154154

155-
* optimizations for `st_sfc()` by @paleolimbot; #1938, #1925
155+
* optimization for `st_sfc()` by @paleolimbot; #1938, #1925
156156

157157
* `[<-.sfc()` recomputes the bounding box; `st_sfc()` gets parameter `compute_bbox`; #1965
158158

@@ -819,7 +819,7 @@
819819

820820
* have `st_graticule` return an empty graticule object when argument `datum` is `NA`;
821821

822-
* export `as_Spatial`, to make it easer for packages to convert `sfc` objects without importing `sf`
822+
* export `as_Spatial`, to make it easier for packages to convert `sfc` objects without importing `sf`
823823

824824
* `st_distance` gains a parameter `by_element` to obtain pairwise distances; #437
825825

@@ -1029,7 +1029,7 @@
10291029

10301030
* add `st_proj_info`, modelled after `rgdal::projInfo`
10311031

1032-
* overwriting datasets with `st_write` is no longer allowed; update=TRUE appends to them, permitted the driver supports appending.
1032+
* overwriting datasets with `st_write()` is no longer allowed; `update=TRUE` appends to them, permitted the driver supports appending.
10331033

10341034
* `st_write` gains an argument, `update`, which when `TRUE` will try to append to existing datasets (#204)
10351035

R/break_antimeridian.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#' the protruding geometries will also be split using the same \code{tol=}
1111
#' values; in this case empty geometries will be dropped first.
1212
#'
13-
#' @param x object of class sf or sfc
13+
#' @param x object of class `sf` or `sfc`
1414
#' @param lon_0 target central longitude (degrees)
1515
#' @param tol half of break width (degrees, default 0.0001)
16-
#' @param ... ingnored here
16+
#' @param ... ignored here
1717
#' @export
1818
#' @name st_break_antimeridian
1919
#' @examples

R/crs.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ st_set_crs = function(x, value) {
241241
#'
242242
#' Assert whether simple feature coordinates are longlat degrees
243243
#' @param x object of class \link{sf} or \link{sfc}, or otherwise an object of a class that has an \link{st_crs} method returning a \code{crs} object
244-
#' @return TRUE if x has geographic coordinates, FALSE if it has projected coordinates, or NA if \code{is.na(st_crs(x))}.
244+
#' @return `TRUE` if `x` has geographic coordinates, `FALSE` if it has projected coordinates, or `NA` if \code{is.na(st_crs(x))}.
245245
#' @export
246246
st_is_longlat = function(x) {
247247
crs = st_crs(x)

R/datasets.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#'
33
#' Sudden Infant Death Syndrome (SIDS) sample data for North Carolina counties,
44
#' two time periods (1974-78 and 1979-84). The details of the columns can be
5-
#' found on the seealso URL, spdep package's vignette. Please note that,
6-
#' though this is basically the same as \code{nc.sids} dataset in spData
5+
#' found in a [spdep package vignette](https://r-spatial.github.io/spdep/articles/sids.html).
6+
#' Please note that, though this is basically the same as \code{nc.sids} dataset in spData
77
#' package, \code{nc} only contains a subset of variables. The differences are
88
#' also discussed on the vignette.
99
#' @format A `sf` object

R/geom-predicates.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ st_geos_binop = function(op, x, y, par = 0.0, pattern = NA_character_,
8080
#' @param x object of class \code{sf}, \code{sfc} or \code{sfg}
8181
#' @param y object of class \code{sf}, \code{sfc} or \code{sfg}
8282
#' @param pattern character; define the pattern to match to, see details.
83-
#' @param sparse logical; should a sparse matrix be returned (TRUE) or a dense matrix?
83+
#' @param sparse logical; should a sparse matrix be returned (`TRUE`) or a dense matrix?
8484
#' @return In case \code{pattern} is not given, \code{st_relate} returns a dense \code{character} matrix; element `[i,j]` has nine characters, referring to the DE9-IM relationship between `x[i]` and `y[j]`, encoded as IxIy,IxBy,IxEy,BxIy,BxBy,BxEy,ExIy,ExBy,ExEy where I refers to interior, B to boundary, and E to exterior, and e.g. BxIy the dimensionality of the intersection of the the boundary of `x[i]` and the interior of `y[j]`, which is one of: 0, 1, 2, or F; digits denoting dimensionality of intersection, F denoting no intersection. When \code{pattern} is given, a dense logical matrix or sparse index list returned with matches to the given pattern; see \link{st_intersection} for a description of the returned matrix or list. See also \url{https://en.wikipedia.org/wiki/DE-9IM} for further explanation.
8585
#' @export
8686
#' @examples
@@ -113,9 +113,9 @@ st_relate = function(x, y, pattern = NA_character_, sparse = !is.na(pattern)) {
113113
#' @name geos_binary_pred
114114
#' @param x object of class \code{sf}, \code{sfc} or \code{sfg}
115115
#' @param y object of class \code{sf}, \code{sfc} or \code{sfg}; if missing, \code{x} is used
116-
#' @param sparse logical; should a sparse index list be returned (TRUE) or a dense logical matrix? See below.
116+
#' @param sparse logical; should a sparse index list be returned (`TRUE`) or a dense logical matrix? See below.
117117
#' @inheritDotParams s2::s2_options
118-
#' @param prepared logical; prepare geometry for x, before looping over y? See Details.
118+
#' @param prepared logical; prepare geometry for `x`, before looping over `y`? See Details.
119119
#' @details If \code{prepared} is \code{TRUE}, and \code{x} contains POINT geometries and \code{y} contains polygons, then the polygon geometries are prepared, rather than the points.
120120
#' @return If \code{sparse=FALSE}, \code{st_predicate} (with \code{predicate} e.g. "intersects") returns a dense logical matrix with element \code{i,j} \code{TRUE} when \code{predicate(x[i], y[j])} (e.g., when geometry of feature i and j intersect); if \code{sparse=TRUE}, an object of class \code{\link{sgbp}} with a sparse list representation of the same matrix, with list element \code{i} an integer vector with all indices j for which \code{predicate(x[i],y[j])} is \code{TRUE} (and hence a zero-length integer vector if none of them is \code{TRUE}). From the dense matrix, one can find out if one or more elements intersect by \code{apply(mat, 1, any)}, and from the sparse list by \code{lengths(lst) > 0}, see examples below.
121121
#' @details For most predicates, a spatial index is built on argument \code{x}; see \url{https://r-spatial.org/r/2017/06/22/spatial-index.html}.
@@ -218,8 +218,8 @@ st_overlaps = function(x, y, sparse = TRUE, prepared = TRUE, ...)
218218
st_geos_binop("overlaps", x, y, sparse = sparse, prepared = prepared, ...)
219219

220220
#' @name geos_binary_pred
221-
#' @param retain_unique logical; if TRUE (and y is missing) return only indexes of points larger than the current index; this can be used to select unique geometries, see examples. This argument can be used for all geometry predictates; see als \link{distinct.sf} to find records where geometries AND attributes are distinct.
222-
#' @param remove_self logical; if TRUE (and y is missing) return only indexes of geometries different from the current index; this can be used to omit self-intersections; see examples. This argument can be used for all geometry predictates
221+
#' @param retain_unique logical; if `TRUE` (and `y` is missing) return only indexes of points larger than the current index; this can be used to select unique geometries, see examples. This argument can be used for all geometry predicates; see also \link{distinct.sf} to find records where geometries AND attributes are distinct.
222+
#' @param remove_self logical; if `TRUE` (and `y` is missing) return only indexes of geometries different from the current index; this can be used to omit self-intersections; see examples. This argument can be used for all geometry predicates
223223
#' @export
224224
st_equals = function(x, y, sparse = TRUE, prepared = FALSE, ...,
225225
retain_unique = FALSE, remove_self = FALSE) {

R/geom-transformers.R

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#' @param mitreLimit numeric; limit of extension for a join if \code{joinStyle} 'MITRE' is used (default 1.0, minimum 0.0); see details
1616
#' @param singleSide logical; if \code{TRUE}, single-sided buffers are returned for linear geometries,
1717
#' in which case negative \code{dist} values give buffers on the right-hand side, positive on the left; see details
18-
#' @param ... passed on to \code{s2_buffer_cells}
18+
#' @param ... passed on to [s2::s2_buffer_cells()]
1919
#' @return an object of the same class of \code{x}, with manipulated geometry.
2020
#' @export
2121
#' @details \code{st_buffer} computes a buffer around this geometry/each geometry. If any of \code{endCapStyle},
@@ -817,7 +817,7 @@ get_first_sfg = function(x) {
817817
#' @note To find whether pairs of simple feature geometries intersect, use
818818
#' the function \code{\link{st_intersects}} instead of \code{st_intersection}.
819819
#'
820-
#' When using GEOS and not using s2 polygons contain their boundary. When using s2 this is determined by the \code{model} defaults of \link[s2]{s2_options}, which can be overriden via the ... argument, e.g. \code{model = "closed"} to force DE-9IM compliant behaviour of polygons (and reproduce GEOS results).
820+
#' When using GEOS and not using s2 polygons contain their boundary. When using s2 this is determined by the \code{model} defaults of \link[s2]{s2_options}, which can be overridden via the ... argument, e.g. \code{model = "closed"} to force DE-9IM compliant behaviour of polygons (and reproduce GEOS results).
821821
#' @examples
822822
#' set.seed(131)
823823
#' library(sf)
@@ -899,7 +899,7 @@ st_difference.sfg = function(x, y, ...)
899899
#' numbers in the argument to \code{x}; geometries that are empty
900900
#' or contained fully inside geometries with higher priority are removed entirely.
901901
#' The \code{st_difference.sfc} method with a single argument returns an object with
902-
#' an \code{"idx"} attribute with the orginal index for returned geometries.
902+
#' an \code{"idx"} attribute with the original index for returned geometries.
903903
st_difference.sfc = function(x, y, ...) {
904904
if (missing(y)) {
905905
if (isTRUE(st_is_longlat(x)))
@@ -978,16 +978,21 @@ st_snap.sf = function(x, y, tolerance)
978978

979979
#' @name geos_combine
980980
#' @export
981-
#' @param by_feature logical; if TRUE, union each feature if \code{y} is missing or else each pair of features; if FALSE return a single feature that is the geometric union of the set of features in \code{x} if \code{y} is missing, or else the unions of each of the elements of the Cartesian product of both sets
982-
#' @param is_coverage logical; if TRUE, use an optimized algorithm for features that form a polygonal coverage (have no overlaps)
981+
#' @param by_feature logical; if `TRUE`, union each feature if \code{y} is missing or else each pair of features; if `FALSE` return a single feature that is the geometric union of the set of features in \code{x} if \code{y} is missing, or else the unions of each of the elements of the Cartesian product of both sets
982+
#' @param is_coverage logical; if `TRUE`, use an optimized algorithm for features that form a polygonal coverage (have no overlaps)
983983
#' @param y object of class \code{sf}, \code{sfc} or \code{sfg} (optional)
984984
#' @param ... ignored
985985
#' @seealso \link{st_intersection}, \link{st_difference}, \link{st_sym_difference}
986986
#' @return If \code{y} is missing, \code{st_union(x)} returns a single geometry with resolved boundaries, else the geometries for all unioned pairs of `x[i]` and `y[j]`.
987987
#' @details
988-
#' If \code{st_union} is called with a single argument, \code{x}, (with \code{y} missing) and \code{by_feature} is \code{FALSE} all geometries are unioned together and an \code{sfg} or single-geometry \code{sfc} object is returned. If \code{by_feature} is \code{TRUE} each feature geometry is unioned individually. This can for instance be used to resolve internal boundaries after polygons were combined using \code{st_combine}. If \code{y} is provided, all elements of \code{x} and \code{y} are unioned, pairwise if \code{by_feature} is TRUE, or else as the Cartesian product of both sets.
988+
#' If \code{st_union} is called with a single argument, \code{x}, (with \code{y} missing) and \code{by_feature} is \code{FALSE} all geometries are unioned together and an \code{sfg} or single-geometry \code{sfc} object is returned.
989+
#' If \code{by_feature} is \code{TRUE} each feature geometry is unioned individually.
990+
#' This can for instance be used to resolve internal boundaries after polygons were combined using \code{st_combine}.
991+
#' If \code{y} is provided, all elements of \code{x} and \code{y} are unioned, pairwise if \code{by_feature} is TRUE, or else as the Cartesian product of both sets.
989992
#'
990-
#' Unioning a set of overlapping polygons has the effect of merging the areas (i.e. the same effect as iteratively unioning all individual polygons together). Unioning a set of LineStrings has the effect of fully noding and dissolving the input linework. In this context "fully noded" means that there will be a node or endpoint in the output for every endpoint or line segment crossing in the input. "Dissolved" means that any duplicate (e.g. coincident) line segments or portions of line segments will be reduced to a single line segment in the output. Unioning a set of Points has the effect of merging all identical points (producing a set with no duplicates).
993+
#' Unioning a set of overlapping polygons has the effect of merging the areas (i.e. the same effect as iteratively unioning all individual polygons together).
994+
#' Unioning a set of LineStrings has the effect of fully noding and dissolving the input linework. In this context "fully noded" means that there will be a node or endpoint in the output for every endpoint or line segment crossing in the input.
995+
#' "Dissolved" means that any duplicate (e.g. coincident) line segments or portions of line segments will be reduced to a single line segment in the output. Unioning a set of Points has the effect of merging all identical points (producing a set with no duplicates).
991996
#' @examples
992997
#' plot(st_union(nc))
993998
st_union = function(x, y, ..., by_feature = FALSE, is_coverage = FALSE) UseMethod("st_union")

R/plot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ kw_dflt = function(x, key.pos) {
2929
#' @param pal palette function, similar to \link{rainbow}, or palette values; if omitted, \code{sf.colors} is used
3030
#' @param nbreaks number of colors breaks (ignored for \code{factor} or \code{character} variables)
3131
#' @param breaks either a numeric vector with the actual breaks, or a name of a method accepted by the \code{style} argument of \link[classInt]{classIntervals}
32-
#' @param max.plot integer; lower boundary to maximum number of attributes to plot; the default value (9) can be overriden by setting the global option \code{sf_max.plot}, e.g. \code{options(sf_max.plot=2)}
32+
#' @param max.plot integer; lower boundary to maximum number of attributes to plot; the default value (9) can be overridden by setting the global option \code{sf_max.plot}, e.g. \code{options(sf_max.plot=2)}
3333
#' @param key.pos numeric; side to plot a color key: 1 bottom, 2 left, 3 top, 4 right; set to \code{NULL} to omit key completely, 0 to only not plot the key, or -1 to select automatically. If multiple columns are plotted in a single function call by default no key is plotted and every submap is stretched individually; if a key is requested (and \code{col} is missing) all maps are colored according to a single key. Auto select depends on plot size, map aspect, and, if set, parameter \code{asp}. If it has lenght 2, the second value, ranging from 0 to 1, determines where the key is placed in the available space (default: 0.5, center).
3434
#' @param key.width amount of space reserved for the key (incl. labels), thickness/width of the scale bar
3535
#' @param key.length amount of space reserved for the key along its axis, length of the scale bar

R/proj.R

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ sf_project = function(from = character(0), to = character(0), pts, keep = FALSE,
8383
#'
8484
#' Query or manage PROJ search path and network settings
8585
#' @param paths the search path to be set; omit if paths need to be queried
86-
#' @param with_proj logical; if `NA` set for both GDAL and PROJ, otherwise set either for PROJ (TRUE) or GDAL (FALSE)
86+
#' @param with_proj logical; if `NA` set for both GDAL and PROJ, otherwise set either for PROJ (`TRUE`) or GDAL (`FALSE`)
8787
#' @return `sf_proj_search_paths()` returns the search path (possibly after setting it)
8888
#' @name proj_tools
8989
#' @export
@@ -103,7 +103,7 @@ sf_proj_search_paths = function(paths = character(0), with_proj = NA) {
103103
}
104104
}
105105

106-
#' @param enable logical; set this to enable (TRUE) or disable (FALSE) the proj network search facility
106+
#' @param enable logical; set this to enable (`TRUE`) or disable (`FALSE`) the proj network search facility
107107
#' @param url character; use this to specify and override the default proj network CDN
108108
#' @return `sf_proj_network` when called without arguments returns a logical indicating whether
109109
#' network search of datum grids is enabled, when called with arguments it returns a character
@@ -117,8 +117,7 @@ sf_proj_network = function(enable = FALSE, url = character(0)) {
117117
CPL_enable_network(url, enable)
118118
}
119119

120-
#' @param source_crs object of class `crs` or character
121-
#' @param target_crs object of class `crs` or character
120+
#' @param source_crs,target_crs object of class `crs` or character
122121
#' @param authority character; constrain output pipelines to those of authority
123122
#' @param AOI length four numeric; desired area of interest for the resulting
124123
#' coordinate transformations (west, south, east, north, in degrees).
@@ -133,15 +132,15 @@ sf_proj_network = function(enable = FALSE, url = character(0)) {
133132
#' registered in the grid_alternatives table of its database) were available. Used typically when
134133
#' networking is enabled.)
135134
#' @param desired_accuracy numeric; only return pipelines with at least this accuracy
136-
#' @param strict_containment logical; default FALSE; permit partial matching of the area
137-
#' of interest; if TRUE strictly contain the area of interest.
135+
#' @param strict_containment logical; default `FALSE`; permit partial matching of the area
136+
#' of interest; if `TRUE` strictly contain the area of interest.
138137
#' The area of interest is either as given in AOI, or as implied by the
139138
#' source/target coordinate reference systems
140-
#' @param axis_order_authority_compliant logical; if FALSE always
139+
#' @param axis_order_authority_compliant logical; if `FALSE` always
141140
#' choose ‘x’ or longitude for the first
142141
#' axis; if TRUE, follow the axis orders given by the coordinate reference systems when
143-
#' constructing the for the first axis; if FALSE, follow the axis orders given by
144-
#' @return `sf_proj_pipelines` returns a table with candidate coordinate transformation
142+
#' constructing the for the first axis; if `FALSE`, follow the axis orders given by
143+
#' @return `sf_proj_pipelines()` returns a table with candidate coordinate transformation
145144
#' pipelines along with their accuracy; `NA` accuracy indicates ballpark accuracy.
146145
#' @name proj_tools
147146
#' @export

0 commit comments

Comments
 (0)