Learn R Programming

lawn (version 0.5.0)

lawn_isolines: Generate Isolines

Description

Takes data-Point's with z-values and an array of value breaks and generates isolines

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

Value

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

Details

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

See Also

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

Examples

Run this code
# 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
# }

Run the code above in your browser using DataLab