From a5258fa7f8299e447eb23e348e69d951e109652c Mon Sep 17 00:00:00 2001 From: Malcolm Morgan Date: Thu, 12 Jan 2023 23:04:44 +0000 Subject: [PATCH] Fix #510 Fix for bug identified in #510 problem occurs when input lines have repeated coordinates for some reason this is acceptable in long linestrings st_is_valid == TRUE but not short linestrings st_is_valid == FALSE --- R/overline.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/overline.R b/R/overline.R index 8224c4ad..b154b6b6 100644 --- a/R/overline.R +++ b/R/overline.R @@ -267,6 +267,9 @@ overline2 <- } if (nrow(sl) > regionalise) { message(paste0("large data detected, using regionalisation, nrow = ", nrow(sl))) + # Fix for https://github.com/ropensci/stplanr/issues/510 + sl <- sl[st_is_valid(sl),] + suppressWarnings(cents <- sf::st_centroid(sl)) # Fix for https://github.com/r-spatial/sf/issues/1777 if(sf::st_is_longlat(cents)){