lawn_within: Return points that fall within polygons

View source: R/within.R

lawn_withinR Documentation

Return points that fall within polygons

Description

Takes a set of data-Point's and a set of data-Polygon's and returns points that fall within the polygons.

Usage

lawn_within(points, polygons, lint = FALSE)

Arguments

points

data-FeatureCollection of points.

polygons

data-FeatureCollection of 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 that land within at least one polygon, as a data-FeatureCollection.

See Also

Other joins: lawn_inside(), lawn_tag()

Examples

## Not run: 
cat(lawn_data$points_within)
cat(lawn_data$polygons_within)
lawn_within(lawn_data$points_within, lawn_data$polygons_within)

pt <- '{
 "type": "Feature",
 "properties": {},
 "geometry": {
    "type": "Point",
    "coordinates": [-90.548630, 14.616599]
  }
}'
poly <- lawn_featurecollection(lawn_buffer(pt, 5))
pts <- lawn_featurecollection(lawn_point(c(-90.55, 14.62)))

lawn_within(pts, poly)

## End(Not run)

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