Skip to contents

This function creates a simple feature collection of points from a series of x, y coordinates.

Usage

create_points(...)

# S3 method for class 'numeric'
create_points(..., crs = NULL)

# S3 method for class 'coordinates'
create_points(coordinates, crs = NULL, ...)

Arguments

...

A series of x, y coordinates.

crs

The coordinate reference system.

coordinates

A coordinates object.

Value

A simple feature points object.

Examples

# Create a points from individual coordinates
points_1 <- create_points(0, 1, 1, 0, 2, 1)
points_1
#> Geometry set for 3 features 
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 0 ymin: 0 xmax: 2 ymax: 1
#> CRS:           NA
#> POINT (0 1)
#> POINT (1 0)
#> POINT (2 1)
plot(points_1)


# Create a linestring from a numeric vector
points_2 <- create_points(
  c(0, 1, 1, 1, 1, 0, 0, 0, 0, 0.5, 1, 0.5)
)
points_2
#> Geometry set for 6 features 
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 0 ymin: 0 xmax: 1 ymax: 1
#> CRS:           NA
#> First 5 geometries:
#> POINT (0 1)
#> POINT (1 1)
#> POINT (1 0)
#> POINT (0 0)
#> POINT (0 0.5)
plot(points_2)