Learn R Programming

lawn (version 0.1.7)

lawn_buffer: Buffer a feature

Description

Calculates a buffer for input features for a given radius

Usage

lawn_buffer(input, dist, units = "kilometers", lint = FALSE)

Arguments

input
A Feature or FeatureCollection
dist
distance used to buffer the input
units
(character) Can be miles, feet, kilometers (default), meters, or degrees
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 transformations: lawn_bezier, lawn_concave, lawn_convex, lawn_erase, lawn_intersect, lawn_merge, lawn_simplify, lawn_union

Examples

Run this code
# From a Point
pt <- '{
 "type": "Feature",
 "properties": {},
 "geometry": {
    "type": "Point",
    "coordinates": [-90.548630, 14.616599]
  }
}'
lawn_buffer(pt, 5)

# From a FeatureCollection
dat <- lawn_random(n = 100)
lawn_buffer(dat, 100)

# From a Feature
dat <- '{
 "type": "Feature",
 "properties": {},
 "geometry": {
     "type": "Polygon",
     "coordinates": [[
       [-112.072391,46.586591],
       [-112.072391,46.61761],
       [-112.028102,46.61761],
       [-112.028102,46.586591],
       [-112.072391,46.586591]
     ]]
   }
}'
lawn_buffer(dat, 1, "miles")

# buffer a point
lawn_buffer(lawn_point(c(-74.50,40)), 100, "meters")

Run the code above in your browser using DataLab