lawn_isolines: Generate Isolines

View source: R/isolines.R

lawn_isolinesR Documentation

Generate Isolines

Description

Takes data-Point's with z-values and an array of value breaks and generates isolines (http://en.wikipedia.org/wiki/Isoline)

Usage

lawn_isolines(
  points,
  breaks,
  z,
  propertiesToAllIsolines = c(),
  propertiesPerIsoline = list(),
  resolution = NULL,
  lint = FALSE
)

Arguments

points

Input points. a point grid, e.g., output of lawn_point_grid()

breaks

(numeric) Where to draw contours.

z

(character) The property name in points from which z-values will be pulled.

propertiesToAllIsolines

GeoJSON properties passed to ALL isolines

propertiesPerIsoline

GeoJSON properties passed, in order, to the correspondent isoline; the breaks array will define the order in which the isolines are created

resolution

(numeric) Resolution of the underlying grid. THIS PARAMETER IS DEFUNCT

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

Warning: this function seems to be broken, not sure why

Value

A data-FeatureCollection of isolines (data-LineString features).

See Also

Other interpolation: lawn_hex_grid(), lawn_planepoint(), lawn_point_grid(), lawn_square_grid(), lawn_tin(), lawn_triangle_grid()

Examples

## Not run: 
# pts <- lawn_random(n = 100, bbox = c(0, 30, 20, 50))
pts <- lawn_point_grid(c(0, 30, 20, 50), 100, 'miles')
pts$features$properties <-
  data.frame(temperature = round(rnorm(NROW(pts$features), mean = 5)),
  stringsAsFactors = FALSE)
breaks <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
lawn_isolines(points = pts, breaks, z = 'temperature')

lawn_isolines(pts, breaks, 'temperature') %>% view

## End(Not run)

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