title: SQL Server Geography (Spartial) finding gaps between instances
body: <p>I have not found a way to spot gaps between geographic instances and I hope you guys can help me with this. The aim would be to find the "gap-polygon". I'm working on the SQL-Server 2012.</p>
  
  <p>Here is an easy example:</p>
  
  <pre><code>CREATE TABLE #temp1
  (
      [ID] [int],
      [Geo] [geography] NOT NULL
  )
  
  INSERT INTO #temp1
  VALUES (1,geography::STGeomFromText('POLYGON((0 0, 0.1 0, 0.1 0.1, 0 0.1,0 0))', 4326))
  
  INSERT INTO #temp1
  VALUES (2,geography::STGeomFromText('POLYGON((0.11 0.05, 0.15 0.05, 0.15 0.15, 0.11 0.15, 0.11 0.05 ))', 4326))
  
  INSERT INTO #temp1
  VALUES (3,geography::STGeomFromText('POLYGON((0 0.1, 0.11 0.1, 0.11 0.15, 0 0.15, 0 0.1))', 4326))
  
  INSERT INTO #temp1
  VALUES (4,geography::STGeomFromText('POLYGON((0.1 0.05, 0.1 0, 0.15 0, 0.15 0.05, 0.1 0.05))', 4326))
  
  SELECT * 
  FROM #temp1
  </code></pre>