Skip to contents

Convert a matrix of points into different formats.

Usage

fm_store_points(loc, crs = NULL, info = NULL, format = NULL, name = NULL)

Arguments

loc

a coordinate matrix

crs

CRS information to associate with the coordinates

info

An optional data.frame of additional data

format

character; "sf", "df", "sp"

name

character; If non-NULL, the name to use for the sf geometry column.

Value

An sf, data.frame, or SpatialPointsDataFrame object, with optional added information.

Examples

fm_store_points(fmexample$loc, format = "sf")
#> Simple feature collection with 10 features and 0 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -2.345698 ymin: -0.9983864 xmax: 1.084441 ymax: 2.415835
#> CRS:           NA
#> # A tibble: 10 × 1
#>                   geometry
#>  *                 <POINT>
#>  1  (-1.207066 -0.4771927)
#>  2  (0.2774292 -0.9983864)
#>  3   (1.084441 -0.7762539)
#>  4  (-2.345698 0.06445882)
#>  5   (0.4291247 0.9594941)
#>  6  (0.5060559 -0.1102855)
#>  7   (-0.57474 -0.5110095)
#>  8 (-0.5466319 -0.9111954)
#>  9  (-0.564452 -0.8371717)
#> 10   (-0.8900378 2.415835)