## SQL Server – Definition and Calculation for Spatial Data

In this blog post. I am just giving the introduction to the Geo Spatial data representation in general and for SQL Server.

**Measurements**

In the planar or flat-earth system, measurements of distances and areas are given in the same unit of measurement as coordinates. Using the geometry data type, the distance between (2, 2) and (5, 6) is 5 units, regardless of the units used.

In the ellipsoidal or round-earth system, coordinates are given in degrees of latitude and longitude. However, lengths and areas are usually measured in meters and square meters, though the measurement may depend on the spatial reference identifier (SRID) of the geography instance. The most common unit of measurement for the geography data type is meters

Geometry is a very complex data type. So, OGC-SFS defines two alternative standard notations to represent Geometry values:

- The
**WKT**(Well Known Text) notation is intended to be user-friendly (not really so user-friendly after all, but at least human readable). - The
**WKB**(Well Known Binary) notation on the other side is more intended for precise and accurate import/export/exchange of Geometries between different platforms.

**Well-Known Text Representation of Spatial Reference Systems**

The definitions of the well-known text representations are modeled after the POSC/EPSG coordinate data.

**Well-Known Binary Representation for Geometry **

The WKB representation of a Geometry value is a continuous stream of bytes. It is obtained by serializing a geometric object as a sequence of numeric types drawn from the set {Unsigned Integer, Double} and then serializing each numeric type as a sequence of bytes using one of two well-defined, standard, binary representations for numeric types (NDR, XDR).

**GML in SQL Server**

The Geography Markup Language (GML) is the XML grammar defined by the Open Geospatial Consortium (OGC) to express geographical features. The geometry data type provides a method that generates a geometry instance from GML, an XML representation of geometric objects. SQL Server supports a subset of GML.

**Full Globe in SQL Server**

In SQL Server 2012, FullGlobe is a special type of Polygon that covers the entire globe. FullGlobe has an area, but no borders or vertices.

**Spatial Reference Identifiers (SRID)**

Spatial Reference System Identifier (SRID) is a unique value that is used to defined and identify a spatial coordinate system. This value id the most important value for any GIS application.

It can be created andÂ implementation by any spatial vendors. But, we have the option to refer to those that are created and maintaining by authorities. Following are the most used SRID system.

Other similar referencing systems are

- Universal Transverse Mercator coordinate system
- British national grid reference system
- Hellenic Geodetic Reference System 1987
- Irish grid reference system
- Irish Transverse Mercator
- Israeli Transverse Mercator
- Israeli Cassini Soldner
- Jordan Transverse Mercator
- Military grid reference system
- United States National Grid

Because, we have to use proper coordinate system in our GIS application in order get accurate result with spatial data processing. For instance, we cannot use two different referencing systems to do any GIS calculations. In SQL Server, if you do so then it will return a null value.