lawn_feature: Create a Feature

Description Usage Arguments See Also Examples

View source: R/lawn_feature.R

Description

Create a Feature

Usage

1
lawn_feature(geometry, properties = c(), lint = FALSE)

Arguments

geometry

(character/json) Any geojson geometry.

properties

(list) list of properties, must be named

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

See Also

Other data functions: lawn_featurecollection(), lawn_filter(), lawn_geometrycollection(), lawn_linestring(), lawn_multilinestring(), lawn_multipoint(), lawn_multipolygon(), lawn_point(), lawn_polygon(), lawn_random(), lawn_remove(), lawn_sample()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# points
## single point
pt <- '{"type":"Point","coordinates":[-75.343,39.984]}'
lawn_feature(pt)

## with properties
lawn_feature(pt, properties = list(foo = "bar"))

## many points in a list
pts <- list(
   lawn_point(c(-75.343, 39.984))$geometry,
   lawn_point(c(-75.833, 39.284))$geometry,
   lawn_point(c(-75.534, 39.123))$geometry
)
lapply(pts, lawn_feature)

## End(Not run)

Example output

<Feature>
  Type: Point
  Bounding box: -75.3 40.0 -75.3 40.0
  No. points: 2
  Properties: NULL
<Feature>
  Type: Point
  Bounding box: -75.3 40.0 -75.3 40.0
  No. points: 2
  Properties: 
     foo: bar
[[1]]
<Feature>
  Type: Point
  Bounding box: -75.3 40.0 -75.3 40.0
  No. points: 2
  Properties: NULL

[[2]]
<Feature>
  Type: Point
  Bounding box: -75.8 39.3 -75.8 39.3
  No. points: 2
  Properties: NULL

[[3]]
<Feature>
  Type: Point
  Bounding box: -75.5 39.1 -75.5 39.1
  No. points: 2
  Properties: NULL

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