It feels like I've been struggling with this 'simple' problem for years, hopefully it is just a noob mistake..
We are using Postgis to facilitate an interface we wrote to do spatial editing, like splitting. When I split a polygon with a linestring, in this example below, the two returned polygons are smaller and creates holes between them and the touching features. As I gathered from other posts, it is due to 'rounding' within st_split - if anyone can confirm?
In this example, it creates a very small hole shown with the black line.
This shouldn't be a problem, because I figured I can just snap the splitted feature to the touching feature or exterior ring of original or, or.. But it doesn't seem like snapping does anything, the original wrong polygons is returned - I tried different snapping tolerances as well.
What I've tried: Straight forward split: Holes created with touching features Iterate through splitted polygons, snapping using different approaches. -snap to exterior ring. -snap to the union of exterior ring and the other splitted polygon. -snap to the union of touching features and the other splitted polygon. All resulted in the same holes, doesn't seem like snapping made any changes. I even tried not using the splitted polygon, but to make a polygon using the difference of the original polygon and the other splitted polygon - but this obviously created unwanted slivers added to the result. Even upgraded from postgis 2.4.4 to 2.5.3, hoping it was a postgis bug.
My end goal is simple, I need to split a polygon with a linestring, and the resulted polygons shouldn't create holes/overlaps with its neighbouring features. But with st_split and/or st_snap, I'm just not getting it right.. Either I'm doing it wrong, or somebody had the same issue and resolution.
Main Polygon that needs to split:
'POLYGON((808369 1000106,808344 999973,807912 999980,807753 1000472,807882 1000643,808409 1000419,808469 1000393,808369 1000106))'
'LINESTRING(807765.0170035374 1000047.1389691661,808173.4773734363 1000627.5826527067)'
Touching features to main polygon:
'POLYGON((808273.979982937 999453.309405212,806977.263634936 999559.01997706,807034 999718,807120 999959,807532 1000288,807742 1000457,807753 1000472,807912 999980,808344 999973,808279 999628,808273.98 999453.31,808273.979982937 999453.309405212))' 'POLYGON((808267 999210,808273.979982937 999453.309405212,808273.98 999453.31,808279 999628,808344 999973,808369 1000106,808469 1000393,808475 1000391,808615 1000065,808618 999395,808620 998905,808640.709074031 998823.783631442,808408.592759303 998769.168027977,808321.474272447 998748.671005211,808267 999210))'