grass icon indicating copy to clipboard operation
grass copied to clipboard

v.fill.holes: Remove isles, keep outer boundary

Open wenzeslaus opened this issue 3 years ago • 3 comments

Example

Input

Screenshot from 2022-07-20 13-02-31

Output

Screenshot from 2022-07-20 13-02-57

wenzeslaus avatar Jul 20 '22 14:07 wenzeslaus

I would like for this to go to core rather than the grass-addons repo because it seems like basic functionality, but I have seen some topology issues with complex data (will post on that later).

wenzeslaus avatar Jul 20 '22 17:07 wenzeslaus

What I'm missing here? I have an issue with the current implementation. If there are touching areas, it does not create a valid topology: some of the areas are not build. The same happens to be me with real-word large data and small hand-drawn data. Any comments or questions welcome.

Failing example

Input

Screenshot from 2022-07-22 15-48-44

Output

Screenshot from 2022-07-22 15-48-51

Output: boundaries and centroids

Screenshot from 2022-07-22 15-50-29

Output: vector digitizer rendering

Screenshot from 2022-07-22 15-50-56

v.build output

Number of centroids exceeds number of areas: 4 > 2
Number of incorrect boundaries: 2
Number of centroids outside area: 2 

Data

GitHub does not take the GRASS pack format even with other file extensions I tried, so it is a zipped .pack file: test2.zip

wenzeslaus avatar Jul 22 '22 20:07 wenzeslaus

Does @metzm have a suggestion here on the topology issue?

neteler avatar Aug 28 '22 10:08 neteler

The new version works! Thanks @metzm for the pointers!

The updated version contains documentation including images and notebook to generate them. I included some notes on topology because it was not what I expected. It as pytest-based tests.

Some features this could have, but I do not plan to implement:

  • maximum (or minimum) size to remove
  • keep features of other vector types (e.g. keep points)
  • keep boundaries with categories (may represent lines which are at the same time boundaries)
  • copy all attribute tables with layer=-1 (Now it copies only relevant rows of the attribute table for the selected layer. This usually should be the whole table because all areas with centroids are kept, so wanting to simply preserve everything makes sense.)

From my perspective, this is ready to merged. Reviews welcome.

wenzeslaus avatar Jul 14 '23 17:07 wenzeslaus

Perhaps change the PR name to make it clear it's a completely new tool.

petrasovaa avatar Jul 17 '23 15:07 petrasovaa