if (require(sf)) {
l1 = st_linestring(cbind(c(1,2,3),c(3,2,2)))
S1<-st_multilinestring(list(l1,cbind(l1[,1]+.05,l1[,2]+.05)))
S2<-st_linestring(cbind(c(1,2,3),c(1,1.5,1)))
sl<-st_sfc(list(S1,S2))
plot(sl, col = c("red", "blue"),reset=FALSE)
trpt<-transLines2pix(sl,mindist=0.1)
plot(st_geometry(trpt),add=TRUE)
}
Run the code above in your browser using DataLab