Geoffrey Emery
Tech Goodness

SQL Server The Geography Data type

April 22, 2009 17:57 by gemery
 

Overview

The most important feature of the geography data type is  that stores Geodetic Spatial Data.

image

this is geodetic model.

This model takes account of the curved shape of the earth. When you perform operations on spatial data using the geography data type, SQL server uses angular computations to work out the result.These computations are calculated based on the ellipsoid model of the earth defined by the spatial reference system of the data in question. For example, if you were to to define a line that connects two points on earths surface in the geography data type the line would curve to follow the surface of the earth

image

Every line drawn in the geography data types are actually great elliptic arc.

Coordinate System

The geography data type is based on a three dimensional, round model so you must use latitude and longitude for coordinates.

Units of Measure

Since we are using Latitude and Longitude to define our points the unit of measure is in degrees. Being degrees is helpful for locating a objects, but not very helpful telling us what the actual distance is between the them. For instance lets say we wanted to know the distance between Los Angeles and Dallas. It would not be very helpful to know that it is 13 degrees away. It would be much more valuable to know that it is 1439 miles away.

To account for this the clever folks at Microsoft tell us to put a spatial reference or SRID in of 4326

So lets take a look what kind of measurement we get when we take the distance for Los Angeles To Dallas

 

Declare @LosAngeles as geography = geography::Point(33.56,118.24,4326)
Declare @Dallas as geography = geography::Point(32.47,96.47,4326)
Select @LosAngeles.STDistance(@Dallas)

 

The Result  is

2033990.01214834 metes

2 033 990.01214834 meters = 1 263.8628 miles

We notice that this is different that the first measurement given that is because the first measurement didn't account for the measurement of the earth.

 

Size Limitations

Due to technical Limitations SQL Server limits the size of any single object must fit inside a single hemisphere of the earth. This also include any computation on these objects. To work around this you can break down these objects into smaller polygons and then and then combine those together.

Sweet so there is the first in a series of posts on SQL Server Spatial that are coming out.

almost forgot.

Ring Orientation

If are drawing a ellipsoid everything is stored counter clock wise.


Related posts

Comments

October 26. 2009 03:01

fast cash loans

Just wanted to say thanks for this.

fast cash loans

November 6. 2011 16:12

pingback

Pingback from gisdoctor.com

Spatial SQL for the Geographer - Introduction|GISDoctor.com

gisdoctor.com

Comments are closed