Title: | Flexible and Intuitive Overlay Methods |
---|---|
Description: | General intersections via a triangle pool from disparate polygon inputs. Overlap is determined via finite-element decomposition of all component edges in all inputs into triangles. Then triangles instances are classified (by point-in-polygon lookup) by objects within layers. |
Authors: | Michael Sumner [aut, cre], Gabriel Becker [ctb] (Provided the package name.) |
Maintainer: | Michael Sumner <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0.9001 |
Built: | 2024-11-05 04:12:47 UTC |
Source: | https://github.com/hypertidy/polymer |
Find overlapping polygons regions by converting a collection of sf data frame polygon layers to a single pool of triangles. The pool is used for subsequent queries, what layers intersect and how, maintaining links to input data of all layers.
A, B, C are three partially overlaying polygon layers with different sets of attributes.
Find all fragments that are intersected by any other feature in any layer.
layer_n(x, n = 2, ..., keep_index = FALSE)
layer_n(x, n = 2, ..., keep_index = FALSE)
x |
polymer |
n |
minimum number of intersections to keep |
... |
ignored for now |
keep_index |
for expert use only, maintains the list of triangle indexes on the sf output (and sf cannot plot if that is present) |
Returns a simple features data frame with all triangles that occur n
times with
n = 2
as a minimum. Each triangle feature contains a nested data frame in idx
that keeps the links to the input layers by layer
, object
and path
.
sf data frame
library(sf) plot(A["layer"], reset = TRUE) plot(B, add = TRUE, col = "hotpink") plot(C, add = TRUE, col = "firebrick") sb <- polymer(A, B, C) plot(layer_n(sb), add = TRUE, col = "grey") plot(layer_n(sb, n = 3), add = TRUE, col = "dodgerblue")
library(sf) plot(A["layer"], reset = TRUE) plot(B, add = TRUE, col = "hotpink") plot(C, add = TRUE, col = "firebrick") sb <- polymer(A, B, C) plot(layer_n(sb), add = TRUE, col = "grey") plot(layer_n(sb, n = 3), add = TRUE, col = "dodgerblue")
The default plot shows only the mesh. If show_intersection = TRUE
, the part
of the mesh that has 2 intersecting regions or more is contrasted to the rest.
## S3 method for class 'polymer' plot(x, ..., show_intersection = FALSE)
## S3 method for class 'polymer' plot(x, ..., show_intersection = FALSE)
x |
polymer |
... |
arguments to polypath |
show_intersection |
logical, plot the intersection region contrasted to the pool (default |
the input, invisibly
plot(polymer(A, B, C)) library(sf) example(st_read) nc <- nc[1:5, ] x <- polymer(nc, st_jitter(nc, amount = 0.1)) plot(x)
plot(polymer(A, B, C)) library(sf) example(st_read) nc <- nc[1:5, ] x <- polymer(nc, st_jitter(nc, amount = 0.1)) plot(x)
Convert a collection of sf data frame polygon layers to a single pool of triangles.
polymer(...)
polymer(...)
... |
sf polygon data frame inputs |
Each triangle is identified by which path in the inputs it belongs to. None of this is very useable yet. Holes can be identified but aren't at the moment, any path that is a hole is identified per triangle.
input
is a list with all input objects
primitives
is the triangulation object
geometry_map
is the paths with their row count
index
is the mapping between triangle and path/s
a polymer, see details
polymer(A, B, C)
polymer(A, B, C)
Print a short description of the polymer contents.
## S3 method for class 'polymer' print(x, ...)
## S3 method for class 'polymer' print(x, ...)
x |
polymer |
... |
ignored |
x invisibly
polymer(A, B, C)
polymer(A, B, C)