constructs an sfc of MULTILINESTRING objects
sfc_multilinestring(
obj = NULL,
x = NULL,
y = NULL,
z = NULL,
m = NULL,
multilinestring_id = NULL,
linestring_id = NULL
)
sfc
object of MULTILINESTRING geometries
sfheaders functions do not perform any validity checks on the geometries. Nor do they set Coordinate Reference Systems, EPSG, PROJ4 or precision attributes.
The data.frame and matrices you send into the sfheader functions must be ordered.
m <- matrix(c(0,0,0,0,1,1), ncol = 3 )
sfc_multilinestring( m )
#> [[1]]
#> [[1]]
#> [,1] [,2] [,3]
#> [1,] 0 0 1
#> [2,] 0 0 1
#>
#> attr(,"class")
#> [1] "XYZ" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 0 0 0 0
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax
#> 1 1
#> attr(,"class")
#> [1] "z_range"
m <- matrix(c(0,0,0,0,0,1,0,1,1,1,2,2,1,2,3), ncol = 3, byrow = TRUE)
sfc_multilinestring( obj = m )
#> [[1]]
#> [[1]]
#> [,1] [,2] [,3]
#> [1,] 0 0 0
#> [2,] 0 0 1
#> [3,] 0 1 1
#> [4,] 1 2 2
#> [5,] 1 2 3
#>
#> attr(,"class")
#> [1] "XYZ" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 0 0 1 2
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax
#> 0 3
#> attr(,"class")
#> [1] "z_range"
sfc_multilinestring( obj = m, multilinestring_id = 1 )
#> [[1]]
#> [[1]]
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 0 1
#> [3,] 1 1
#>
#> attr(,"class")
#> [1] "XY" "MULTILINESTRING" "sfg"
#>
#> [[2]]
#> [[1]]
#> [,1] [,2]
#> [1,] 2 2
#> [2,] 2 3
#>
#> attr(,"class")
#> [1] "XY" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 0 0 2 3
#> attr(,"class")
#> [1] "bbox"
sfc_multilinestring( obj = m, linestring_id = 1 )
#> [[1]]
#> [[1]]
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 0 1
#> [3,] 1 1
#>
#> [[2]]
#> [,1] [,2]
#> [1,] 2 2
#> [2,] 2 3
#>
#> attr(,"class")
#> [1] "XY" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 0 0 2 3
#> attr(,"class")
#> [1] "bbox"
sfc_multilinestring( obj = m, linestring_id = 1, multilinestring_id = 1 )
#> [[1]]
#> [[1]]
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 0 1
#> [3,] 1 1
#>
#> attr(,"class")
#> [1] "XY" "MULTILINESTRING" "sfg"
#>
#> [[2]]
#> [[1]]
#> [,1] [,2]
#> [1,] 2 2
#> [2,] 2 3
#>
#> attr(,"class")
#> [1] "XY" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 0 0 2 3
#> attr(,"class")
#> [1] "bbox"
sfc_multilinestring( obj = m, x = 2, y = 3 )
#> [[1]]
#> [[1]]
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 0 1
#> [3,] 1 1
#> [4,] 2 2
#> [5,] 2 3
#>
#> attr(,"class")
#> [1] "XY" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 0 0 2 3
#> attr(,"class")
#> [1] "bbox"
sfc_multilinestring( obj = m, x = 1, y = 2, z = 3 )
#> [[1]]
#> [[1]]
#> [,1] [,2] [,3]
#> [1,] 0 0 0
#> [2,] 0 0 1
#> [3,] 0 1 1
#> [4,] 1 2 2
#> [5,] 1 2 3
#>
#> attr(,"class")
#> [1] "XYZ" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 0 0 1 2
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax
#> 0 3
#> attr(,"class")
#> [1] "z_range"
sfc_multilinestring( obj = m, x = 2, y = 3, linestring_id = 1, multilinestring_id = 1 )
#> [[1]]
#> [[1]]
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 0 1
#> [3,] 1 1
#>
#> attr(,"class")
#> [1] "XY" "MULTILINESTRING" "sfg"
#>
#> [[2]]
#> [[1]]
#> [,1] [,2]
#> [1,] 2 2
#> [2,] 2 3
#>
#> attr(,"class")
#> [1] "XY" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 0 0 2 3
#> attr(,"class")
#> [1] "bbox"
df <- data.frame(
ml_id = c(1,1,1,1,1,1,1,1,2,2,2,2,2)
, l_id = c(1,1,1,2,2,3,3,3,1,1,1,2,2)
, x = rnorm(13)
, y = rnorm(13)
, z = rnorm(13)
, m = rnorm(13)
)
sfc_multilinestring( obj = df, x = "x", y = "y")
#> [[1]]
#> [[1]]
#> [,1] [,2]
#> [1,] -0.1050687 -0.470922497
#> [2,] 0.9824534 -0.133251019
#> [3,] -1.7133026 1.226682356
#> [4,] -0.8320195 0.332943995
#> [5,] 1.1004919 -0.347088466
#> [6,] -0.1738201 -0.098550690
#> [7,] 0.1788120 0.034766060
#> [8,] -0.6984294 0.386127022
#> [9,] -0.9604492 0.020831228
#> [10,] -0.9754230 0.007586777
#> [11,] -0.3385765 0.930844030
#> [12,] 1.1523471 -0.684749941
#> [13,] 0.4051012 0.337401513
#>
#> attr(,"class")
#> [1] "XY" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> -1.7133026 -0.6847499 1.1523471 1.2266824
#> attr(,"class")
#> [1] "bbox"
sfc_multilinestring( obj = df, x = "x", y = "y", z = "z")
#> [[1]]
#> [[1]]
#> [,1] [,2] [,3]
#> [1,] -0.1050687 -0.470922497 -0.412137704
#> [2,] 0.9824534 -0.133251019 0.934261130
#> [3,] -1.7133026 1.226682356 1.840316741
#> [4,] -0.8320195 0.332943995 -0.704819663
#> [5,] 1.1004919 -0.347088466 0.008510312
#> [6,] -0.1738201 -0.098550690 2.034189886
#> [7,] 0.1788120 0.034766060 -1.341686068
#> [8,] -0.6984294 0.386127022 1.158979182
#> [9,] -0.9604492 0.020831228 -0.203208958
#> [10,] -0.9754230 0.007586777 -0.378028555
#> [11,] -0.3385765 0.930844030 1.736111043
#> [12,] 1.1523471 -0.684749941 -0.845247816
#> [13,] 0.4051012 0.337401513 -0.961571493
#>
#> attr(,"class")
#> [1] "XYZ" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> -1.7133026 -0.6847499 1.1523471 1.2266824
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax
#> -1.341686 2.034190
#> attr(,"class")
#> [1] "z_range"
sfc_multilinestring( obj = df, x = "x", y = "y", z = "z", m = "m")
#> [[1]]
#> [[1]]
#> [,1] [,2] [,3] [,4]
#> [1,] -0.1050687 -0.470922497 -0.412137704 1.01749105
#> [2,] 0.9824534 -0.133251019 0.934261130 -1.49605374
#> [3,] -1.7133026 1.226682356 1.840316741 -1.18481873
#> [4,] -0.8320195 0.332943995 -0.704819663 0.63023437
#> [5,] 1.1004919 -0.347088466 0.008510312 2.10125251
#> [6,] -0.1738201 -0.098550690 2.034189886 -0.61373681
#> [7,] 0.1788120 0.034766060 -1.341686068 -1.63463827
#> [8,] -0.6984294 0.386127022 1.158979182 -0.01044112
#> [9,] -0.9604492 0.020831228 -0.203208958 -0.65650614
#> [10,] -0.9754230 0.007586777 -0.378028555 -0.66953344
#> [11,] -0.3385765 0.930844030 1.736111043 -0.47858903
#> [12,] 1.1523471 -0.684749941 -0.845247816 1.31945632
#> [13,] 0.4051012 0.337401513 -0.961571493 0.63656276
#>
#> attr(,"class")
#> [1] "XYZM" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> -1.7133026 -0.6847499 1.1523471 1.2266824
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax
#> -1.341686 2.034190
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#> mmin mmax
#> -1.634638 2.101253
#> attr(,"class")
#> [1] "m_range"
sfc_multilinestring( obj = df, x = 2, y = 3)
#> [[1]]
#> [[1]]
#> [,1] [,2]
#> [1,] 1 -0.1050687
#> [2,] 1 0.9824534
#> [3,] 1 -1.7133026
#> [4,] 2 -0.8320195
#> [5,] 2 1.1004919
#> [6,] 3 -0.1738201
#> [7,] 3 0.1788120
#> [8,] 3 -0.6984294
#> [9,] 1 -0.9604492
#> [10,] 1 -0.9754230
#> [11,] 1 -0.3385765
#> [12,] 2 1.1523471
#> [13,] 2 0.4051012
#>
#> attr(,"class")
#> [1] "XY" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 1.000000 -1.713303 3.000000 1.152347
#> attr(,"class")
#> [1] "bbox"
sfc_multilinestring( obj = df, x = 2, y = 3, z = 4)
#> [[1]]
#> [[1]]
#> [,1] [,2] [,3]
#> [1,] 1 -0.1050687 -0.470922497
#> [2,] 1 0.9824534 -0.133251019
#> [3,] 1 -1.7133026 1.226682356
#> [4,] 2 -0.8320195 0.332943995
#> [5,] 2 1.1004919 -0.347088466
#> [6,] 3 -0.1738201 -0.098550690
#> [7,] 3 0.1788120 0.034766060
#> [8,] 3 -0.6984294 0.386127022
#> [9,] 1 -0.9604492 0.020831228
#> [10,] 1 -0.9754230 0.007586777
#> [11,] 1 -0.3385765 0.930844030
#> [12,] 2 1.1523471 -0.684749941
#> [13,] 2 0.4051012 0.337401513
#>
#> attr(,"class")
#> [1] "XYZ" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 1.000000 -1.713303 3.000000 1.152347
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax
#> -0.6847499 1.2266824
#> attr(,"class")
#> [1] "z_range"
sfc_multilinestring( obj = df, x = 2, y = 3, z = 4, m = 5)
#> [[1]]
#> [[1]]
#> [,1] [,2] [,3] [,4]
#> [1,] 1 -0.1050687 -0.470922497 -0.412137704
#> [2,] 1 0.9824534 -0.133251019 0.934261130
#> [3,] 1 -1.7133026 1.226682356 1.840316741
#> [4,] 2 -0.8320195 0.332943995 -0.704819663
#> [5,] 2 1.1004919 -0.347088466 0.008510312
#> [6,] 3 -0.1738201 -0.098550690 2.034189886
#> [7,] 3 0.1788120 0.034766060 -1.341686068
#> [8,] 3 -0.6984294 0.386127022 1.158979182
#> [9,] 1 -0.9604492 0.020831228 -0.203208958
#> [10,] 1 -0.9754230 0.007586777 -0.378028555
#> [11,] 1 -0.3385765 0.930844030 1.736111043
#> [12,] 2 1.1523471 -0.684749941 -0.845247816
#> [13,] 2 0.4051012 0.337401513 -0.961571493
#>
#> attr(,"class")
#> [1] "XYZM" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> 1.000000 -1.713303 3.000000 1.152347
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax
#> -0.6847499 1.2266824
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#> mmin mmax
#> -1.341686 2.034190
#> attr(,"class")
#> [1] "m_range"
sfc_multilinestring( obj = df, multilinestring_id = "ml_id", linestring_id = "l_id" )
#> [[1]]
#> [[1]]
#> [,1] [,2] [,3] [,4]
#> [1,] -0.1050687 -0.4709225 -0.4121377 1.017491
#> [2,] 0.9824534 -0.1332510 0.9342611 -1.496054
#> [3,] -1.7133026 1.2266824 1.8403167 -1.184819
#>
#> [[2]]
#> [,1] [,2] [,3] [,4]
#> [1,] -0.8320195 0.3329440 -0.704819663 0.6302344
#> [2,] 1.1004919 -0.3470885 0.008510312 2.1012525
#>
#> [[3]]
#> [,1] [,2] [,3] [,4]
#> [1,] -0.1738201 -0.09855069 2.034190 -0.61373681
#> [2,] 0.1788120 0.03476606 -1.341686 -1.63463827
#> [3,] -0.6984294 0.38612702 1.158979 -0.01044112
#>
#> attr(,"class")
#> [1] "XYZM" "MULTILINESTRING" "sfg"
#>
#> [[2]]
#> [[1]]
#> [,1] [,2] [,3] [,4]
#> [1,] -0.9604492 0.020831228 -0.2032090 -0.6565061
#> [2,] -0.9754230 0.007586777 -0.3780286 -0.6695334
#> [3,] -0.3385765 0.930844030 1.7361110 -0.4785890
#>
#> [[2]]
#> [,1] [,2] [,3] [,4]
#> [1,] 1.1523471 -0.6847499 -0.8452478 1.3194563
#> [2,] 0.4051012 0.3374015 -0.9615715 0.6365628
#>
#> attr(,"class")
#> [1] "XYZM" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> -1.7133026 -0.6847499 1.1523471 1.2266824
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax
#> -1.341686 2.034190
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#> mmin mmax
#> -1.634638 2.101253
#> attr(,"class")
#> [1] "m_range"
sfc_multilinestring( obj = df, multilinestring_id = 1, linestring_id = 2 )
#> [[1]]
#> [[1]]
#> [,1] [,2] [,3] [,4]
#> [1,] -0.1050687 -0.4709225 -0.4121377 1.017491
#> [2,] 0.9824534 -0.1332510 0.9342611 -1.496054
#> [3,] -1.7133026 1.2266824 1.8403167 -1.184819
#>
#> [[2]]
#> [,1] [,2] [,3] [,4]
#> [1,] -0.8320195 0.3329440 -0.704819663 0.6302344
#> [2,] 1.1004919 -0.3470885 0.008510312 2.1012525
#>
#> [[3]]
#> [,1] [,2] [,3] [,4]
#> [1,] -0.1738201 -0.09855069 2.034190 -0.61373681
#> [2,] 0.1788120 0.03476606 -1.341686 -1.63463827
#> [3,] -0.6984294 0.38612702 1.158979 -0.01044112
#>
#> attr(,"class")
#> [1] "XYZM" "MULTILINESTRING" "sfg"
#>
#> [[2]]
#> [[1]]
#> [,1] [,2] [,3] [,4]
#> [1,] -0.9604492 0.020831228 -0.2032090 -0.6565061
#> [2,] -0.9754230 0.007586777 -0.3780286 -0.6695334
#> [3,] -0.3385765 0.930844030 1.7361110 -0.4785890
#>
#> [[2]]
#> [,1] [,2] [,3] [,4]
#> [1,] 1.1523471 -0.6847499 -0.8452478 1.3194563
#> [2,] 0.4051012 0.3374015 -0.9615715 0.6365628
#>
#> attr(,"class")
#> [1] "XYZM" "MULTILINESTRING" "sfg"
#>
#> attr(,"n_empty")
#> [1] 0
#> attr(,"crs")
#> $input
#> [1] NA
#>
#> $wkt
#> [1] NA
#>
#> attr(,"class")
#> [1] "crs"
#> attr(,"class")
#> [1] "sfc_MULTILINESTRING" "sfc"
#> attr(,"precision")
#> [1] 0
#> attr(,"bbox")
#> xmin ymin xmax ymax
#> -1.7133026 -0.6847499 1.1523471 1.2266824
#> attr(,"class")
#> [1] "bbox"
#> attr(,"z_range")
#> zmin zmax
#> -1.341686 2.034190
#> attr(,"class")
#> [1] "z_range"
#> attr(,"m_range")
#> mmin mmax
#> -1.634638 2.101253
#> attr(,"class")
#> [1] "m_range"