-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sliver Polygons #18
Comments
Thanks for pointing this out, it's definitely not ideal! I'm not too surprised this happens since the package treats every polygon individually, so there's essentially no effort to preserve the topology between features. It would definitely be nice to solve this, but to be honest, I don't have any ideas for ways to do this in a simple way. Do you have any thoughts? |
I thought I would chime in and say that I haven't noticed sliver polygons, but I do get gaps between polygons like in the second image above. In terms of solving the issue: it has been suggested to me that a way to do it would be to decompose the polygons into shared line segments and do the smoothing on the line segments. Then you would have to reconstruct the polygons afterward. |
Thanks for the suggestion! I doubt I'll have the time to implement a fix, but if I do have some spare time, this seems like a viable path. |
Sorry for the late reply ! Didn't find as much time as I expected in my current project.. Anyways as @odgersn pointed out, using linesmoothing does help, albeit only in situations where there are a no more than two polygons of different classes. Smoothing decomposed lines instead of polygons (2 classes) Still problematic smoothed polygons (3 classes) One problem that still persists even with linesmoothing and only two unique polygon classes is which polygons should be connected (see 2nd example). This could be solved by an additional argument, such as connect largest/smallest/etc. polygons |
Also I'm curious as to why @odgersn didn't get sliver polygons. Have you checked it with |
I'm also interrested in the issue and an implemented version of polygon snapping among smoothr package. For now, I'm using the ms_simplify function from the rmapshaper package with a keep parameter of 1 (100 %) and a snap_interval of 10.
Thanks ! |
First up, thanks for creating and maintaining this great package !
I've been using the smooth function on some SpatVectors containing polygons with different values, and noticed that it introduces sliver polygons. The geometry itself is valid, but running
terra::gaps()
returns said sliver polygons. Unfortunately, the sliver polygons can become quite large, especially when three or more polygons with different values are next to each other, so usingterra::snap()
couldn't solve the problem.Here's a sample of the unsmoothed polygons I found the smoothing function has an especially hard time with

Here's a picture of the same polygons after smoothing and the different sliver polygons that were introduced.

Finally here's what the result I'm striving for would look like (using the ArcGIS Smooth Polygon tool).

I'm not sure if this is beyond the intended scope of the package, but I thought it won't hurt to point out the issue. I would love to help working on the issue, so please let me know if you are interested in solving the issue.
The text was updated successfully, but these errors were encountered: