Learn R Programming

lawn (version 0.6.0)

lawn_truncate: Truncate

Description

Takes a GeoJSON Feature or FeatureCollection and truncates the precision of the geometry.

Usage

lawn_truncate(x, precision = 6, coordinates = 2, mutate = FALSE, lint = FALSE)

Arguments

precision

(integer) coordinate decimal precision. default: 6

coordinates

(integer) maximum number of coordinates (primarily used to remove z coordinates). default: 2

mutate

(logical) allows GeoJSON input to be mutated (significant performance increase if true) Default: FALSE

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-Feature or data-FeatureCollection with truncated geometry

See Also

Other misc: lawn_flatten()

Examples

Run this code
# NOT RUN {
cat(lawn_data$filter_features)
lawn_coordall(lawn_data$filter_features)
lawn_truncate(lawn_data$filter_features, 4) %>% lawn_coordall
lawn_truncate(lawn_data$filter_features, 2) %>% lawn_coordall
lawn_truncate(lawn_data$filter_features, 4, 1) %>% lawn_coordall
# }

Run the code above in your browser using DataLab