lawn_difference | R Documentation |
Finds the difference between two data-Polygon's by clipping the second polygon from the first.
lawn_difference(poly1, poly2, lint = FALSE)
poly1 |
A data-Feature<(data-Polygon)> feature |
poly2 |
data-Feature<(data-Polygon)> to erase from poly1 |
lint |
(logical) Lint or not. Uses geojsonhint. Takes up increasing
time as the object to get linted increases in size, so probably use by
default for small objects, but not for large if you know they are good
geojson objects. Default: |
a data-Feature<(data-Polygon)> feature showing the area of poly1 excluding the area of poly2
Other transformations:
lawn_bezier()
,
lawn_buffer()
,
lawn_concave()
,
lawn_convex()
,
lawn_intersect()
,
lawn_merge()
,
lawn_simplify()
,
lawn_union()
## Not run: # skipping on cran poly1 <- '{ "type": "Feature", "properties": { "fill": "#0f0" }, "geometry": { "type": "Polygon", "coordinates": [[ [-46.738586, -23.596711], [-46.738586, -23.458207], [-46.560058, -23.458207], [-46.560058, -23.596711], [-46.738586, -23.596711] ]] } }' poly2 <- '{ "type": "Feature", "properties": { "fill": "#00f" }, "geometry": { "type": "Polygon", "coordinates": [[ [-46.650009, -23.631314], [-46.650009, -23.5237], [-46.509246, -23.5237], [-46.509246, -23.631314], [-46.650009, -23.631314] ]] } }' lawn_difference(poly1, poly2) ## End(Not run) ## Not run: lawn_featurecollection(list(poly1, poly2)) %>% view lawn_difference(poly1, poly2) %>% view fc <- lawn_featurecollection(list( lawn_polygon(jsonlite::fromJSON(poly1)$geometry$coordinates), lawn_polygon(jsonlite::fromJSON(poly2)$geometry$coordinates) )) view(fc) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.