I think there might be a bug in your line_segment() function when using the segment_length argument.
E.g.
> l <- routes_fast_sf[2, ]
> l_split <- line_segment(l = l, segment_length = 500)
Error in Ops.units(n_segments, 1) :
both operands of the expression should be "units" objects
The cause appears to be that round(l_length/segment_length) returns an object in units , which causes n_segments + 1 to fail.
Hi,
Thanks for a very cool package!
I think there might be a bug in your
line_segment()
function when using thesegment_length
argument.E.g.
The cause appears to be that
round(l_length/segment_length)
returns an object in units , which causesn_segments + 1
to fail.https://github.com/ropensci/stplanr/blob/8a9c7b5a9309c48a542e157205fdaff1ddee120e/R/linefuns.R#L157-L164
Coercing
n_segments
to a numeric should fix this.