st_startpoint: Return the start and end points from lines

Description Usage Arguments Details Value Examples

View source: R/startpoint.R

Description

Return the start and end points from lines

Usage

1
2
3

Arguments

x

line of class sf, sfc or sfg

Details

see https://postgis.net/docs/ST_StartPoint.html and https://postgis.net/docs/ST_EndPoint.html.

Value

sf object representing start and end points

Examples

1
2
3
4
5
6
7
8
library(sf)
m = matrix(c(0, 1, 2, 0, 1, 4), ncol = 2)
l = st_sfc(st_linestring(m))
lwgeom::st_startpoint(l)
lwgeom::st_endpoint(l)
l2 = st_sfc(st_linestring(m), st_linestring(m[3:1, ]))
lwgeom::st_startpoint(l2)
lwgeom::st_endpoint(l2)

lwgeom documentation built on Oct. 6, 2021, 5:12 p.m.

Related to st_startpoint in lwgeom...