sp.CutSptialLines: Cut sptialLines with threshold. 'sp.CutSptialLines'

Description Usage Arguments Examples

View source: R/Func_GIS.R

Description

Cut sptialLines with threshold. sp.CutSptialLines

Usage

1

Arguments

sl

SpatialLines or SpatialLineDataFrame

tol

Tolerence. If the length of segment is larger than tolerance, cut the segment until the maximum segment is shorter than tolerance.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(PIHMgisR)
library(sp)
x=1:1000/100
l1 = Lines(Line(cbind(x, sin(x)) ), ID='a' )
sl = SpatialLines( list(l1) )
tol1=5;
tol2 =2
sl1 = sp.CutSptialLines(sl, tol1)
sl2 = sp.CutSptialLines(sl, tol2)
par(mfrow=c(1,2))
plot(sl1, col=1:length(sl1));title(paste0('Tol=', tol1))
plot(sl2, col=1:length(sl2));title(paste0('Tol=', tol2))

data(sh)
riv=sh$riv
x = sp.CutSptialLines(riv, tol=5)
par(mfrow=c(2,1))
plot(riv, col=1:length(riv), lwd=3);

plot(riv, col='gray', lwd=3);
plot(add=TRUE, x, col=1:length(x))

happynotes/PIHMgisR documentation built on Jan. 25, 2020, 9:51 p.m.