lawn_collect: Collect method

View source: R/collect.R

lawn_collectR Documentation

Collect method

Description

Given an inProperty on points and an outProperty for polygons, this finds every point that lies within each polygon, collects the inProperty values from those points, and adds them as an array to outProperty on the polygon.

Usage

lawn_collect(polygons, points, in_field, out_field, lint = FALSE)

Arguments

polygons

a data-FeatureCollection of data-Polygon features

points

a data-FeatureCollection of data-Point features

in_field

(character) the field in input data to analyze

out_field

(character) the field in which to store results

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

A FeatureCollection of data-Polygon features with properties listed as out_field

Author(s)

Jeff Hollister hollister.jeff@epa.gov

See Also

Other aggregations: lawn_average(), lawn_count(), lawn_deviation(), lawn_max(), lawn_median(), lawn_min(), lawn_sum(), lawn_variance()

Examples

ex_polys <- lawn_data$polygons_aggregate
ex_pts <- lawn_data$points_aggregate
res <- lawn_collect(ex_polys, ex_pts, 'population', 'stuff')
res$type
res$features
res$features$properties

## Not run: 
lawn_collect(ex_polys, ex_pts, 'population', 'stuff') %>% view

## End(Not run)

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