Skip to contents

Convert objects to fm_segm

Usage

fm_as_segm(x, ...)

fm_as_segm_list(x, ...)

# S3 method for fm_segm
fm_as_segm(x, ...)

# S3 method for inla.mesh.segment
fm_as_segm(x, ...)

# S3 method for sfg
fm_as_segm(x, ...)

# S3 method for sfc_POINT
fm_as_segm(x, reverse = FALSE, grp = NULL, is.bnd = TRUE, ...)

# S3 method for sfc_LINESTRING
fm_as_segm(x, join = TRUE, grp = NULL, reverse = FALSE, ...)

# S3 method for sfc_MULTILINESTRING
fm_as_segm(x, join = TRUE, grp = NULL, reverse = FALSE, ...)

# S3 method for sfc_POLYGON
fm_as_segm(x, join = TRUE, grp = NULL, ...)

# S3 method for sfc_MULTIPOLYGON
fm_as_segm(x, join = TRUE, grp = NULL, ...)

# S3 method for sfc_GEOMETRY
fm_as_segm(x, grp = NULL, join = TRUE, ...)

# S3 method for sf
fm_as_segm(x, ...)

# S3 method for matrix
fm_as_segm(
  x,
  reverse = FALSE,
  grp = NULL,
  is.bnd = FALSE,
  crs = NULL,
  closed = FALSE,
  ...
)

# S3 method for SpatialPoints
fm_as_segm(x, reverse = FALSE, grp = NULL, is.bnd = TRUE, closed = FALSE, ...)

# S3 method for SpatialPointsDataFrame
fm_as_segm(x, ...)

# S3 method for Line
fm_as_segm(x, reverse = FALSE, grp = NULL, crs = NULL, ...)

# S3 method for Lines
fm_as_segm(x, join = TRUE, grp = NULL, crs = NULL, ...)

# S3 method for SpatialLines
fm_as_segm(x, join = TRUE, grp = NULL, ...)

# S3 method for SpatialLinesDataFrame
fm_as_segm(x, ...)

# S3 method for SpatialPolygons
fm_as_segm(x, join = TRUE, grp = NULL, ...)

# S3 method for SpatialPolygonsDataFrame
fm_as_segm(x, ...)

# S3 method for Polygons
fm_as_segm(x, join = TRUE, crs = NULL, grp = NULL, ...)

# S3 method for 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. Default TRUE

join

logical; if TRUE, join input segments with common vertices. Default TRUE

crs

A crs object

closed

logical; whether to treat a point sequence as a closed polygon. Default: FALSE

Value

An fm_segm or fm_segm_list object

Functions

  • fm_as_segm(): Convert an object to fm_segm.

  • fm_as_segm_list(): Convert each element, making a fm_segm_list object

Examples

fm_as_segm_list(list(
  fm_segm(fmexample$mesh),
  fm_segm(fmexample$mesh, boundary = FALSE)
))
#> 31 boundary edges (1 group: 1)
#> 56 interior edges (1 group: 1)

(segm <- fm_segm(fmexample$mesh, boundary = FALSE))
#> fm_segm object:
#>   56 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.591451 1.033681 0, -2.817059 0...
(fm_as_segm(segm_sfc))
#> fm_segm object:
#>   56 interior edges (1 group: 1)
#>   Bounding box = (-3.344418, 2.076846) x (-1.995602, 3.404937) x (0,0)