 <p>I'm not sure how you'd get the "shared" LineStrings from your shapes. Secondly, once you reduce a "subset" of the shape since your endpoints may move from the original and you will not be able to make them match up after reduction.</p> <p>The nutshell of what I would do is basically use boolean operations to play with the reduced shapes.</p> <p>First, do what you do, namely create a temporary table of reduced shapes (called <code>#ReducedShapes</code>). </p> <p>Then, I would create a second temp table and find the areas of overlap (using <code>STIntersection</code>) between all shapes. In this table, I would basically have columns <code>naam1</code>, <code>naam2</code> and <code>intsec</code>, the last one being of type shape. Something like (untested):</p> <pre><code>INSERT INTO #IntSecs(naam1, naam2, intsec) SELECT s1.naam, s2.naam, s1.naam.STIntersection(s2.naam) FROM #ReducedShapes s1, #ReducedShapes s2 WHERE s1.naam.STIntersection(s2.naam) IS NOT NULL </code></pre> <p>This gets you a list of where pairs of shapes overlap. In fact, you have two rows for each overlap. For example, if A and B overlap you'd have and . I would make a pass and delete one of the two for each occurence.</p> <p>Lastly, for each overlap, I would subtract (<code>STDifference</code>) the intersection <strong>from only one of the two</strong> regions in the pair from the <code>#ReducedShapes</code> table. Imagine you have two squares A and B, half-overlapping. The operation would involve A.STDifference(B) meaning you keep all of B and half of A. I would insert the modified shapes into a third table (say <code>#ModifiedShapes</code>).</p> <p>Two problems: a) as you can see from your "orange" and "blue" shapes, they did not reduce similarly, so you'll get one of two possible reductions depending on how you deal with who "wins". b) a more complicated form of the problem is that, depending on the complexity of the initial shapes, you may get overlap between three or more regions. You'll have to determine your own way to establish which one shape "wins" in that intersection, based on your particular needs. It's not clear if there are constraints. Could be as simple as arbitrarily picking a winner by ordering, or more complicated since accuracy is important. </p> <p>The above concept unfortunately does not address the issue of gaps. This one's a little more complicated and I am not 100% sure how to resolve it. But, if you create a third table that subtracts (<code>STDifference</code> again) all the modified shapes <code>#ModifiedShapes</code> from all the original shapes in <code>#Shapes</code> (testing for overlap before actually subtracting, of course), you'd be left with the remainder shapes in the gaps. You'd want to aggregate the adjoining shapes and assign a "winning color", possibly merging it back in with the related shape.</p> <p>This answer is long and I will leave it like this. I may be barking up the wrong tree. Based on your feedback/questions, I would add to the post.</p>