Last Updated: February 25, 2016
·
562
· purekrome

Sql Server Geography shape that is accidently covering the entire planet!

Given a valid polygon, but the shape covers the entire planet?

Australia!

The points are fine, it's just the ring-orientation is (somehow) wrong. So we need to flip it.

SELECT a.Polygon.ReorientObject()
FROM SomeTable
WHERE Id = @SomeId

That's it!

NOTE: This only works with Sql Server 2012 (and greater).

(Image and code tip sourced from Alistair Aitchison's blog)