The “other fullglobe feature” in SQL Server Denali

Now about that "other" feature that could be called fullglobe in Denali that I mentioned. I don't know which feature will retain the moniker or whether they both will…that's why I'm not in marketing.

Here's the deal… the SQL Server spatial geography type is limited to a single hemisphere in size in SQL Server 2008 and R2. That doesn't mean that a single feature can't span hemispheres, it means the feature can't be bigger than a hemisphere. And it means that there is a "left-foot rule" that you must follow for geography polygons. You might also have heard it called "left-hand rule", but Ed renamed it, as there already is a well-known right-hand rule in mathematics and physics.

The rule is really meant for disambiguation; if I code up a polygon that describes Iceland, am I representing Iceland or "everything on earth that isn't Iceland"? The left-foot rule makes it unambiguous.

Anyhow, Denali removes the hemisphere limit, so you can represent "not Iceland". And provides a cool convenience feature to make this easy. So here's code inspired by my first (but not my last) teaching gig in Reykjavik, a few years ago, in December (thanks Gunner). I enjoyed myself immensely, especially in the geothermal-heated public pool near downtown (yes, its open in December, sorry, no link).

— here's Iceland
SELECT geog
FROM dbo.cntry00
WHERE cntry_name = 'Iceland'

— here's everywhere that's not Iceland
— well, it better be "not Iceland" I can't see it in spatial results
SELECT geog.ReorientObject()
FROM dbo.cntry00
WHERE cntry_name = 'Iceland'

The only fallout I can envision from this is that some folks might have used the error to indicate their ring-orientation was wrong. Now it will just work, and you'll wind up with "big 'ol hunk o' geography" (TM pending) instead. So if you are one of those people beware…it works now. For the rest of the things that used to break and that this feature fixes reference Ed and Milan's excellent whitepaper.

@bobbeauch

Other articles

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.