This function allows you to interactively edit features in a shapefile using the mapedit package.
Usage
shapefile_edit(
shapefile,
mosaic = NULL,
basemap = NULL,
r = 3,
g = 2,
b = 1,
max_pixels = 3e+06
)
Arguments
- shapefile
A shapefile (
sf
object) that can be created withshapefile_input()
.- mosaic
Optionally, a mosaic (SpatRaster) to be displayed as a background.
- basemap
An optional
mapview
object.- r
Red band index for RGB display (default is 3).
- g
Green band index for RGB display (default is 2).
- b
Blue band index for RGB display (default is 1).
- max_pixels
Maximum number of pixels for down-sampling the mosaic (default is 3e6).
Examples
if (interactive() && requireNamespace("EBImage")) {
library(pliman)
shp <- shapefile_input(system.file("ex/lux.shp", package="terra"))
edited <- shapefile_edit(shp)
}
#> class : SpatVector
#> geometry : polygons
#> dimensions : 12, 6 (geometries, attributes)
#> extent : 5.74414, 6.528252, 49.44781, 50.18162 (xmin, xmax, ymin, ymax)
#> source : lux.shp
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> names : ID_1 NAME_1 ID_2 NAME_2 AREA POP
#> type : <num> <chr> <num> <chr> <num> <int>
#> values : 1 Diekirch 1 Clervaux 312 18081
#> 1 Diekirch 2 Diekirch 218 32543
#> 1 Diekirch 3 Redange 259 18664
#>
#> Listening on http://127.0.0.1:6534
#> Warning: `select_()` was deprecated in dplyr 0.7.0.
#> ℹ Please use `select()` instead.
#> ℹ The deprecated feature was likely used in the mapedit package.
#> Please report the issue at <https://github.com/r-spatial/mapedit/issues>.