utils_shapefile | R Documentation |
shapefile_input()
creates or imports a shapefile and optionally converts
it to an sf
object. It can also cast POLYGON
or MULTIPOLYGON
geometries
to MULTILINESTRING
if required.
shapefile_export()
exports an object (sf
or SpatVector
) to a file.
shapefile_view()
is a simple wrapper around mapview()
to plot a shapefile.
shapefile_input(
shapefile,
info = TRUE,
as_sf = TRUE,
multilinestring = FALSE,
...
)
shapefile_export(shapefile, filename, ...)
shapefile_view(
shapefile,
attribute = NULL,
type = c("shape", "centroid"),
color_regions = custom_palette(c("red", "yellow", "forestgreen")),
...
)
shapefile |
For For |
info |
Logical value indicating whether to print information about the
imported shapefile (default is |
as_sf |
Logical value indicating whether to convert the imported
shapefile to an |
multilinestring |
Logical value indicating whether to cast polygon geometries
to |
... |
Additional arguments to be passed to |
filename |
The path to the output shapefile. |
attribute |
The attribute to be shown in the color key. It must be a
variable present in |
type |
A character string specifying whether to visualize the shapefile
as |
color_regions |
The color palette to represent |
shapefile_input()
returns an object of class sf
(default) representing
the imported shapefile.
shapefile_export()
returns a NULL
object.
shapefile_view()
returns an object of class mapview
.
if(interactive()){
library(pliman)
shp <- system.file("ex/lux.shp", package="terra")
shp_file <- shapefile_input(shp, as_sf = FALSE)
shapefile_view(shp_file)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.