SQLServer 2008 Spatial Types like SqlGeography enables the storage of geographical points, lines and polygons in an SQLServer database.

SqlGeography Polygons vs KML Polygons

  • Microsoft has restricted the maximum size of a valid SqlGeography polygon such that it must be smaller than a hemisphere.

    Think of it as not being able to draw an area equal or more than half the planet Earth.

  • For this restriction to actually have a meaningful effect, it becomes necessary for SQLServer 2008 to make a distinction between the inside and the outside of a polygonal area.

    For example, imagine a polygon of Australia. It is immediately possible to imagine the inside of the polygon as the land area of Australia.

    When we do this, we have immediately discounted the possibility that the polygon represents an area larger than a hemisphere, that is, the inside of the polygon is NOT the land of Australia.

  • To determine what is to be considered the inside of a polygon, a polygon is defined with its points defined in a counter clockwise direction. The area on the left side of the outline will then be the inside of the polygon.
  • Another important requirement of an SqlGeography polygon is the last point must be the same as its first point. This requirement is also present in a KML polygon.

geography Methods

  • If you want to query for a geography object within another geography object, it's too bad; SQLServer 2008 does not implement STWithin() for geography objects.

Last updated on 17 July 2009
133, New Bridge Road #24-01
Chinatown Point S(049513) •
Tel: 6-552-6826 •
Copyright Bumble Bee Laboratories Pte. Ltd. July 2020