-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Boolean clockwise | ||
#' | ||
#' @export | ||
#' @param line line [data-Feature]<([data-LineString])> | ||
#' @family boolean functions | ||
#' @return a logical (`TRUE`/`FALSE`) | ||
#' @examples | ||
#' l1 <- '[[0,0],[1,1],[1,0],[0,0]]' | ||
#' l2 <- '[[0,0],[1,0],[1,1],[0,0]]' | ||
#' lawn_boolean_clockwise(lawn_linestring(l1)) | ||
#' lawn_boolean_clockwise(lawn_linestring(l2)) | ||
lawn_boolean_clockwise <- function(line, lint = FALSE) { | ||
lawnlint(line, lint) | ||
ct$eval(sprintf("var bcw = turf.booleanClockwise(%s);", convert(line))) | ||
ct$get("bcw") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Boolean contains | ||
#' | ||
#' @export | ||
#' @param feature1,feature2 any [data-Geometry]/[data-Feature] objects | ||
#' @family boolean functions | ||
#' @return a logical (`TRUE`/`FALSE`) | ||
#' @examples | ||
#' l1 <- '[[1, 1], [1, 2], [1, 3], [1, 4]]' | ||
#' pt1 <- '[1, 2]' | ||
#' lawn_boolean_contains(feature1=lawn_linestring(l1), feature2=lawn_point(pt1)) | ||
lawn_boolean_contains <- function(feature1, feature2, lint = FALSE) { | ||
lawnlint(list(feature1, feature2), lint) | ||
ct$eval(sprintf("var bcon = turf.booleanContains(%s, %s);", | ||
convert(feature1), convert(feature2))) | ||
ct$get("bcon") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Boolean crosses | ||
#' | ||
#' @export | ||
#' @param feature1,feature2 any [data-Geometry]/[data-Feature] objects | ||
#' @family boolean functions | ||
#' @return a logical (`TRUE`/`FALSE`) | ||
#' @examples | ||
#' l1 <- '[[-2, 2], [4, 2]]' | ||
#' l2 <- '[[1, 1], [1, 2], [1, 3], [1, 4]]' | ||
#' lawn_boolean_crosses(lawn_linestring(l1), lawn_linestring(l2)) | ||
lawn_boolean_crosses <- function(feature1, feature2, lint = FALSE) { | ||
lawnlint(list(feature1, feature2), lint) | ||
ct$eval(sprintf("var bcr = turf.booleanCrosses(%s, %s);", | ||
convert(feature1), convert(feature2))) | ||
ct$get("bcr") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Boolean crosses | ||
#' | ||
#' @export | ||
#' @param feature1,feature2 any [data-Geometry]/[data-Feature] objects | ||
#' @family boolean functions | ||
#' @return a logical (`TRUE`/`FALSE`) | ||
#' @examples | ||
#' pt1 <- '[2, 2]' | ||
#' l1 <- '[[1, 1], [1, 2], [1, 3], [1, 4]]' | ||
#' lawn_boolean_disjoint(lawn_point(pt1), lawn_linestring(l2)) | ||
lawn_boolean_disjoint <- function(feature1, feature2, lint = FALSE) { | ||
lawnlint(list(feature1, feature2), lint) | ||
ct$eval(sprintf("var bdj = turf.booleanDisjoint(%s, %s);", | ||
convert(feature1), convert(feature2))) | ||
ct$get("bdj") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#' Boolean overlap | ||
#' | ||
#' @export | ||
#' @param feature1,feature2 any [data-Geometry]/[data-Feature]( | ||
#' <[data-LineString]|[data-MultiLineString]|[data-Polygon]|[data-MultiPolygon]) | ||
#' objects | ||
#' @family boolean functions | ||
#' @return a logical (`TRUE`/`FALSE`) | ||
#' @examples | ||
#' poly1 <- "[[[0,0],[0,5],[5,5],[5,0],[0,0]]]" | ||
#' poly2 <- "[[[1,1],[1,6],[6,6],[6,1],[1,1]]]" | ||
#' poly3 <- "[[[10,10],[10,15],[15,15],[15,10],[10,10]]]" | ||
#' lawn_boolean_overlap(lawn_polygon(poly1), lawn_polygon(poly2)) | ||
#' lawn_boolean_overlap(lawn_polygon(poly2), lawn_polygon(poly3)) | ||
lawn_boolean_overlap <- function(feature1, feature2, lint = FALSE) { | ||
lawnlint(list(feature1, feature2), lint) | ||
ct$eval(sprintf("var bover = turf.booleanOverlap(%s, %s);", | ||
convert(feature1), convert(feature2))) | ||
ct$get("bover") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#' Boolean overlap | ||
#' | ||
#' @export | ||
#' @param point any [data-Geometry]/[data-Feature](<[data-Point]>) | ||
#' @param linestring any [data-Geometry]/[data-Feature](<[data-LineString]>) | ||
#' @param ignoreEndVertices (logical) whether to ignore the start and end | ||
#' vertices. Default: `FALSE | ||
#' @family boolean functions | ||
#' @return a logical (`TRUE`/`FALSE`) | ||
#' @examples | ||
#' l1 <- "[[-1, -1],[1, 1],[1.5, 2.2]]" | ||
#' lawn_boolean_pointonline(lawn_point("[0, 0]"), lawn_linestring(l1)) | ||
lawn_boolean_pointonline <- function(point, linestring, | ||
ignoreEndVertices = FALSE, lint = FALSE) { | ||
|
||
lawnlint(list(point, linestring), lint) | ||
ct$eval(sprintf("var bpol = turf.booleanPointOnLine(%s, %s, %s);", | ||
convert(point), convert(linestring), | ||
convert(ignoreEndVertices))) | ||
ct$get("bpol") | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.