Convert objects to fm_segm
Usage
fm_as_segm(x, ...)
fm_as_segm_list(x, ...)
# S3 method for class 'fm_segm'
fm_as_segm(x, ...)
# S3 method for class 'inla.mesh.segment'
fm_as_segm(x, ...)
# S3 method for class 'sfg'
fm_as_segm(x, ...)
# S3 method for class 'sfc_POINT'
fm_as_segm(x, reverse = FALSE, grp = NULL, is.bnd = TRUE, ...)
# S3 method for class 'sfc_LINESTRING'
fm_as_segm(x, join = TRUE, grp = NULL, reverse = FALSE, ...)
# S3 method for class 'sfc_MULTILINESTRING'
fm_as_segm(x, join = TRUE, grp = NULL, reverse = FALSE, ...)
# S3 method for class 'sfc_POLYGON'
fm_as_segm(x, join = TRUE, grp = NULL, ...)
# S3 method for class 'sfc_MULTIPOLYGON'
fm_as_segm(x, join = TRUE, grp = NULL, ...)
# S3 method for class 'sfc_GEOMETRY'
fm_as_segm(x, grp = NULL, join = TRUE, ...)
# S3 method for class 'sf'
fm_as_segm(x, ...)
# S3 method for class 'matrix'
fm_as_segm(
x,
reverse = FALSE,
grp = NULL,
is.bnd = FALSE,
crs = NULL,
closed = FALSE,
...
)
# S3 method for class 'SpatialPoints'
fm_as_segm(x, reverse = FALSE, grp = NULL, is.bnd = TRUE, closed = FALSE, ...)
# S3 method for class 'SpatialPointsDataFrame'
fm_as_segm(x, ...)
# S3 method for class 'Line'
fm_as_segm(x, reverse = FALSE, grp = NULL, crs = NULL, ...)
# S3 method for class 'Lines'
fm_as_segm(x, join = TRUE, grp = NULL, crs = NULL, ...)
# S3 method for class 'SpatialLines'
fm_as_segm(x, join = TRUE, grp = NULL, ...)
# S3 method for class 'SpatialLinesDataFrame'
fm_as_segm(x, ...)
# S3 method for class 'SpatialPolygons'
fm_as_segm(x, join = TRUE, grp = NULL, ...)
# S3 method for class 'SpatialPolygonsDataFrame'
fm_as_segm(x, ...)
# S3 method for class 'Polygons'
fm_as_segm(x, join = TRUE, crs = NULL, grp = NULL, ...)
# S3 method for class 'Polygon'
fm_as_segm(x, crs = NULL, ...)
Arguments
- x
Object to be converted.
- ...
Arguments passed on to submethods
- reverse
logical; When TRUE, reverse the order of the input points. Default
FALSE
- grp
if non-null, should be an integer vector of grouping labels for one for each segment. Default
NULL
- is.bnd
logical; if
TRUE
, set the boundary flag for the segments. DefaultTRUE
- join
logical; if
TRUE
, join input segments with common vertices. DefaultTRUE
- crs
A crs object
- closed
logical; whether to treat a point sequence as a closed polygon. Default:
FALSE
Functions
fm_as_segm()
: Convert an object tofm_segm
.fm_as_segm_list()
: Convert each element, making afm_segm_list
object
See also
c.fm_segm()
, c.fm_segm_list()
,
[.fm_segm_list()
Other object creation and conversion:
fm_as_fm()
,
fm_as_lattice_2d()
,
fm_as_mesh_1d()
,
fm_as_mesh_2d()
,
fm_as_mesh_3d()
,
fm_as_sfc()
,
fm_as_tensor()
,
fm_lattice_2d()
,
fm_mesh_1d()
,
fm_mesh_2d()
,
fm_segm()
,
fm_simplify()
,
fm_tensor()
Examples
fm_as_segm_list(list(
fm_segm(fmexample$mesh),
fm_segm(fmexample$mesh, boundary = FALSE)
))
#> 29 boundary edges (1 group: 1)
#> 54 interior edges (1 group: 1)
(segm <- fm_segm(fmexample$mesh, boundary = FALSE))
#> fm_segm object:
#> 54 interior edges (1 group: 1)
#> Bounding box = (-3.344418, 2.076846) x (-1.995602, 3.404937) x (0,0)
(segm_sfc <- fm_as_sfc(segm))
#> Geometry set for 1 feature
#> Geometry type: LINESTRING
#> Dimension: XYZ
#> Bounding box: xmin: -3.344418 ymin: -1.995602 xmax: 2.076846 ymax: 3.404937
#> z_range: zmin: 0 zmax: 0
#> CRS: NA
#> LINESTRING Z (-2.817059 0.9463137 0, -2.998821 ...
(fm_as_segm(segm_sfc))
#> fm_segm object:
#> 54 interior edges (1 group: 1)
#> Bounding box = (-3.344418, 2.076846) x (-1.995602, 3.404937) x (0,0)