lawn_inside: Does a point reside inside a polygon

Description Usage Arguments Details Value See Also Examples

View source: R/inside.R

Description

Takes a data-Point and a data-Polygon or data-MultiPolygon and determines if the point resides inside the polygon

Usage

1
lawn_inside(point, polygon, lint = FALSE)

Arguments

point

Input point.

polygon

Input polygon or multipolygon.

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

Details

The polygon can be convex or concave. The function accounts for holes.

Value

TRUE if the Point IS inside the Polygon, FALSE if the Point IS NOT inside the Polygon.

See Also

Other joins: lawn_tag(), lawn_within()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
point1 <- '{
  "type": "Feature",
  "properties": {
    "marker-color": "#f00"
  },
  "geometry": {
    "type": "Point",
    "coordinates": [-111.467285, 40.75766]
  }
}'
point2 <- '{
  "type": "Feature",
  "properties": {
    "marker-color": "#0f0"
  },
  "geometry": {
    "type": "Point",
    "coordinates": [-111.873779, 40.647303]
  }
}'
poly <- '{
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-112.074279, 40.52215],
      [-112.074279, 40.853293],
      [-111.610107, 40.853293],
      [-111.610107, 40.52215],
      [-112.074279, 40.52215]
      ]]
  }
}'
lawn_inside(point1, poly)
lawn_inside(point2, poly)

lawn documentation built on Jan. 6, 2021, 5:07 p.m.