lawn_tag: Spatial join of points and polygons

View source: R/tag.R

lawn_tagR Documentation

Spatial join of points and polygons

Description

Takes a set of data-Point's and a set of data-Polygon's and performs a spatial join.

Usage

lawn_tag(points, polygons, field, out_field, lint = FALSE)

Arguments

points

Input data-FeatureCollection<(data-Point)>

polygons

Input data-FeatureCollection<(data-Polygon)> or data-FeatureCollection<(data-MultiPolygon)>

field

Property in polygons to add to joined Point features.

out_field

Property in points in which to store joined property from polygons.

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: FALSE

Value

Points with containing_polyid property containing values from poly_id, as data-FeatureCollection<(data-Point)>

See Also

Other joins: lawn_inside(), lawn_within()

Examples

bbox <- c(0, 0, 10, 10)
pts <- lawn_random(n = 30, bbox = bbox)
polys <- lawn_triangle_grid(bbox, 50, 'miles')
polys$features$properties$fill <- "#f92"
polys$features$properties$stroke <- 0
polys$features$properties$`fill-opacity` <- 1
lawn_tag(pts, polys, 'fill', 'marker-color')
## Not run: 
lawn_tag(pts, polys, 'fill', 'marker-color') %>% view

## End(Not run)

ropensci/lawn documentation built on May 18, 2022, 9:58 a.m.