Spatial Data

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance

Spatial data represents information about the physical location and shape of geometric objects. These objects can be point locations or more complex objects such as countries/regions, roads, or lakes.

SQL Server supports two spatial data types: the geometry data type and the geography data type.

  • The geometry type represents data in a Euclidean (flat) coordinate system.

  • The geography type represents data in a round-earth coordinate system.

Both data types are implemented as .NET common language runtime (CLR) data types in SQL Server.

Related Tasks

Create, Construct, and Query geometry Instances
Describes the methods that you can use with instances of the geometry data type.

Create, Construct, and Query geography Instances
Describes the methods that you can use with instances of the geography data type.

Query Spatial Data for Nearest Neighbor
Describes the common query pattern that is used to find the closest spatial objects to a specific spatial object.

Create, Modify, and Drop Spatial Indexes
Provides information about creating, altering, and dropping a spatial index.

Spatial Data Types Overview
Introduces the spatial data types.

Spatial Indexes Overview
Introduces spatial indexes and describes tessellation and tessellation schemes.

Spatial tools open-source project

SQL Server spatial tools is a Microsoft sponsored open-source collection of tools for use with the spatial types in SQL Server. This project provides a set of reusable functions which applications can make use of. These functions may include data conversion routines, new transformations, aggregates, etc. See Microsoft/SQLServerSpatialTools in GitHub for more details.