0

I have geography data stored in SQL Server and I am trying to merge polygons from two data sets together. The problem is that they do not line up exactly, so unioning them results in narrow gaps along the boundaries between the two sets. What's the easiest way to removed these seams? I am currently doing this in SQL Server, so if I could do this with tools SQL Server provides, that would be ideal. Otherwise I'm open to using another, preferably free tool.

inexact polygon merge

Rono
  • 131
  • 2
  • 8

1 Answers1

0

To get rid of the seams I found that using the following query works quite well:

SELECT ID, shape.STBuffer(15).STDifference((SELECT GEOGRAPHY::UnionAggregate(shape) 
 FROM TableName AS sub 
WHERE sub.ID <> TableName.ID ))
FROM TableName

What this does is to only extend the borders along the outside border of the collection of shapes. The STBuffer extends the size of each shape in the collection. The STDifference part trims off any excess that overlaps within the collection of shapes, leaving the outside borders extended. This extended part covers up the seams when unioning the shapes together with other collections. The value passed to STBuffer should be adjusted to be as small as possible and still cover the seams to avoid possible distortion.

Rono
  • 131
  • 2
  • 8