segmentize: Create segmented line from points' sequence

Description Usage Arguments Details Value Author(s) Examples

Description

Connect sequence of points (locations) by direct lines (tracks)

Usage

1
segmentize(obj, connect=c("consequent", "united"))

Arguments

obj

Simple feature (package sf) or Spatial abstract class (package sp) with POINTS spatial geometry.

connect

Structure of output segments; either sequence of single segments ("consequent") or single multi-segment ("united").

Details

Function generates n-1 segments from n input points. Data (attribute table) is trasfered to output object with excluding of first row.

Value

Simple feature (package sf) or Spatial abstract class (package sp) with LINESTRING spatial geometry.

Author(s)

Nikita Platonov platonov@sevin.ru

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
session_grid(NULL)
n <- 15
lon <- rev(sort(runif(n,min=40,max=60)))
lat <- sort(runif(n,min=30,max=50))
pt <- data.frame(lon=lon,lat=lat,value=seq(n))
sp::coordinates(pt) <- c("lon","lat")
sp::proj4string(pt) <- "+proj=longlat"
ct <- ursa_colortable(colorize(pt$value))
tr <- segmentize(pt)
session_grid(pt,expand=1.1)
compose_open(2)
panel_new()
panel_plot(pt,col=ct)
panel_decor()
panel_new()
panel_plot(tr,col=ct,lwd=3)
panel_decor()
compose_legend(ct)
compose_close()

ursa documentation built on May 23, 2021, 1:06 a.m.