Description Usage Arguments Value Examples
View source: R/transform_scale.R
Scale a GeoJSON from a given point by a factor of scaling (ex: factor=2 would make the GeoJSON 200% larger). If a FeatureCollection is provided, the origin point will be calculated based on each individual Feature.
1 2 3 4 5 6 7 | lawn_transform_scale(
x,
factor,
origin = "centroid",
mutate = FALSE,
lint = FALSE
)
|
x |
a feature |
factor |
(integer/numeric) of scaling, positive or negative values greater than 0 |
origin |
(integer/numeric) Point from which the scaling will occur (string options: sw/se/nw/ne/center/centroid) (optional, default "centroid") |
mutate |
(logical) allows GeoJSON input to be mutated (significant
performance increase if true) (optional). Default: |
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: |
a scaled data-Feature
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | x <- '{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[ 0, 29 ], [ 3.5, 29 ], [ 2.5, 32 ], [ 0, 29 ]
]
]
}
}'
lawn_transform_scale(x, factor = 3)
lawn_transform_scale(x, factor = 100)
lawn_transform_scale(x, factor = 100, mutate = TRUE)
## Not run:
view(lawn_featurecollection(x))
view(lawn_featurecollection(
lawn_transform_scale(x, factor = 2)
))
view(lawn_featurecollection(
lawn_transform_scale(x, factor = 3)
))
view(lawn_featurecollection(
lawn_transform_scale(x, factor = 2, origin = "sw")
))
view(lawn_featurecollection(
lawn_transform_scale(x, factor = 2, origin = "ne")
))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.