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

View source: R/Func_GIS.R

sp.CutSptialLinesR Documentation

Cut sptialLines with threshold. sp.CutSptialLines

Description

Cut sptialLines with threshold. sp.CutSptialLines

Usage

sp.CutSptialLines(sl, tol)

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

library(rSHUD)
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))

SHUD-System/SHUDtoolbox documentation built on Nov. 27, 2024, 5:54 a.m.