1

I have a landmask derived from Landsat, transformed into polygons. Due to the raster origin, there are a lot of 4 line nodes (see picture), creating "holes" of unmasked area within the polygons. A no-value area is created by surround polygon. At one point the polygon is connected in only one node, creating a closure. Picture. Black polygon/raster land area, white unmasked/no value area.

The small contained white quadrats are a problem, while the uncontained must remain unmasked/no-value. I can not use these black polygons, since (fetchR) in R then complains due to "TopologyException /.../ Ring Self-intersection". I estimate the nodes to be at least a hundred. Can anyone think of

A. a workaround, fixing these nodes automatically, e.g. by at each node connected by >2 lines create two juxtaposed nodes OR filling these areas (either as polygon/raster).

B. a quick way to identify these nodes for manual fixing.

  • In raster calculator convert no data to say 1. Convert to polygons. Select one that share boundary with original. Merge, dissolve. – FelixIP Sep 14 '17 at 20:19
  • That is one way to fix them one by one. Very labor intensive, but might use that as a way out. Thanks. – Rasmus Gustafsson Sep 15 '17 at 21:25
  • It will take a minute to fix all of them. Select ONES that share boundary with original. I do it all the time to fix stray cells for hundreds of subcatchments – FelixIP Sep 15 '17 at 21:41
1

You can use 'Eliminate Polygon Part' tool. You would use the 'contained_only' option. You can also specify area or percentage parameters for the removal condition.

Here are the docs: Eliminate Polygon Part

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.