You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried using the ksmooth smoothing function on a SHP file (uploaded to Google Drive, follow link below). I checked to ensure that the input (x) is valid. However, the output (y) contains invalid geometry, and cannot be saved back into a SHP file.
Hi Andrew, thanks for the bug report! I'm not too surprised since I'm using a fairly simple approach for the smoothing and I don't have a great grasp about the how these sf objects are stored or about geometric operations on then.
Your original shapefile has several geometries each composed of multiple polygons. As a starting point, I was able to extract just the one polygon that's causing the problem.
library(sf)
library(smoothr)
x <- st_read("~/Downloads/makes_invalid2/makes_invalid2.shp")[21,] %>%
st_geometry()
x <- st_polygon(list(x[[1]][[1]]))
any(!st_is_valid(x))
y <- smooth(x, method = "ksmooth", smoothness = 4)
any(!st_is_valid(y))
But that's as far as I've gotten, I still can't pinpoint exactly what the issue is. I'll keep fiddling around, although it's possible this is over my head.
Hello,
I tried using the
ksmooth
smoothing function on a SHP file (uploaded to Google Drive, follow link below). I checked to ensure that the input (x
) is valid. However, the output (y
) contains invalid geometry, and cannot be saved back into a SHP file.https://drive.google.com/file/d/1w7P-oRr7EohAcX0nE71zQza53nmjUb7f/view?usp=sharing
Thanks!
The text was updated successfully, but these errors were encountered: