lawn_featureeach: Iterate over features in any GeoJSON object

View source: R/featureeach.R

lawn_featureeachR Documentation

Iterate over features in any GeoJSON object

Description

Iterate over features in any GeoJSON object

Usage

lawn_featureeach(x, fun = NULL, lint = FALSE)

Arguments

x

any data-GeoJSON object

fun

a Javascript function. if not given, returns self

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

matrix of coordinates, where each row in the matrix is a coordinate pair

Examples

x <- "{ type: 'Feature', geometry: null, properties: { foo: 1, bar: 3 } }"

# don't apply any function, identity essentially
lawn_featureeach(x)

lawn_featureeach(lawn_data$points_count)

# appply a function callback
lawn_featureeach(lawn_data$points_count, "z.geometry")
lawn_featureeach(lawn_data$points_count, "z.geometry.type")
lawn_featureeach(lawn_data$points_count, "z.properties")
lawn_featureeach(lawn_data$points_count, "z.properties.population")

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