Spatial index in SQL Server


Spatial index

The spatial index is designed to handle indexing spatial type column and has been available since SQL Server 2008. A spatial data-type is used for data storage for geography and geometry.
Handed devices like mobile supported the features like GPS and Maps, the need to store spatial data in a relational database is more than ever before. Spatial data identifies places and boundaries on the earth. Microsoft added support in SQL Server 2008 with the introduction of native spatial data types to represent spatial objects. At the same time, Microsoft added the required functionality to access and index spatial data.

The spatial data type of SQL Server allows us to store spatial objects and make them available for an application. SQL Server supports two spatial data types:

1.      Geometry: coordinates X and Y, which represent lines, points or polygons.
2.      Geography: Coordinates latitude and longitude which represents lines, points or polygons.

How to create a spatial index?

The following script will help you to create a spatial index in SQL Server.



CREATE SPATIAL INDEX IX_Address_SpatialLocation ON Person.Address(SpatialLocation);

Related Posts

What is the Use of isNaN Function in JavaScript? A Comprehensive Explanation for Effective Input Validation

In the world of JavaScript, input validation is a critical aspect of ensuring that user-provided data is processed correctly. One indispensa...