Handling of sf polygons with more than one feature
Closed this issue · 1 comments
The calcLineLengths
and makeLines
functions take an sf object as an input. We developed these on sf polygons with one feature, and are seeing unexpected behavior when users upload polygons with multiple features (e.g., the calcLineLengths
function calculates a line length for each feature, but the underlying math is suspect). Consider adding a union/dissolve step to coerce the sf object into a single feature.
For calcLineLengths
, adding a simple st_union
to the input polygon should solve the problem.
For makeLines
, @grcatlin has found a related issue caused by multiple features and/or holes in the polygon and has a lead on a potential fix there.
@grcatlin , can you create a branch for this issue and tackle the updates to both calcLineLengths
and makeLines
?