Description Usage Arguments Value Examples
Iterate over features in any GeoJSON object
1 | lawn_featureeach(x, fun = NULL, lint = FALSE)
|
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: |
matrix of coordinates, where each row in the matrix is a coordinate pair
1 2 3 4 5 6 7 8 9 10 11 12 | 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")
|
$type
[1] "Feature"
$geometry
[1] NA
$properties
foo bar
1 1 3
$type
[1] "Feature" "Feature"
$properties
population
1 200
2 600
$geometry
type coordinates
1 Point -112.03720, 46.60806
2 Point -112.04596, 46.59626
$type
[1] "Point" "Point"
$coordinates
$coordinates[[1]]
[1] -112.03720 46.60806
$coordinates[[2]]
[1] -112.04596 46.59626
[[1]]
[1] "Point"
[[2]]
[1] "Point"
$population
[1] 200 600
[[1]]
[1] 200
[[2]]
[1] 600
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.