| title | Extended methods on geography instances | |
|---|---|---|
| description | Reference for SQL Server-specific extended methods on geography instances, providing additional functionality beyond OGC standard methods. | |
| author | MladjoA | |
| ms.author | mlandzic | |
| ms.date | 02/05/2026 | |
| ms.service | sql | |
| ms.subservice | t-sql | |
| ms.topic | reference | |
| ms.custom |
|
|
| dev_langs |
|
|
| monikerRange | =azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb | |
| ai-usage | ai-assisted |
[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]
SQL Server supports extended methods on geography instances that go beyond the Open Geospatial Consortium (OGC) standard methods. These extended methods provide additional functionality for working with geographic data, including Z (elevation) and M (measure) values, precise buffer operations, simplified representations, and enhanced WKT/WKB formats.
While OGC methods provide standardized spatial operations defined by the OpenGIS specification, extended methods offer SQL Server-specific enhancements:
- OGC methods: Standardized operations for interoperability with other geospatial systems. Use when standards compliance is required.
- Extended methods: SQL Server-specific operations that provide additional functionality, performance optimizations, or support for features not covered by OGC standards (such as circular arcs, Z/M values, and advanced buffer control).
For most spatial tasks, OGC methods provide the necessary functionality. Use extended methods when you need the extra capabilities they provide.
These methods provide alternative formats for representing geography data, including support for Z (elevation) and M (measure) values.
| Method | Description |
|---|---|
| AsBinaryZM (geography Data Type) | Returns the OGC Well-Known Binary (WKB) representation augmented with Z (elevation) and M (measure) values. |
| AsTextZM | Returns the OGC Well-Known Text (WKT) representation augmented with Z (elevation) and M (measure) values. |
| AsGml | Returns the Geography Markup Language (GML) representation of a geography instance. |
| ToString | Returns the string representation of a geography instance augmented with Z and M values. |
These methods access the Z (elevation) and M (measure) values of geography instances, supporting 3D and 4D spatial data.
| Method | Description |
|---|---|
| Lat | Returns the latitude property of a Point geography instance. |
| Long | Returns the longitude property of a Point geography instance. |
| Z | Returns the Z (elevation) value of a geography instance. Null if not defined. |
| M | Returns the M (measure) value of a geography instance. Null if not defined. |
| HasZ (geography Data Type) | Returns 1 if a geography instance contains at least one point with a Z value. |
| HasM (geography Data Type) | Returns 1 if a geography instance contains at least one point with an M value. |
These methods provide more control over buffer calculations than the standard OGC STBuffer method.
| Method | Description |
|---|---|
| BufferWithTolerance | Returns a geometric object representing all points within a specified distance from a geography instance, with explicit tolerance control for precision. |
| BufferWithCurves (geography Data Type) | Returns a geography instance representing all points within a specified distance, preserving circular arc segments in the result. |
These methods create simplified versions of geography instances, useful for performance optimization and visualization at different scales.
| Method | Description |
|---|---|
| Reduce | Returns a simplified approximation of a geography instance produced by running the Douglas-Peucker algorithm with the specified tolerance. |
| CurveToLineWithTolerance (geography Data Type) | Returns a polygonal approximation of a geography instance containing circular arc segments, with explicit tolerance control. |
These methods provide information about the bounding region of a geography instance.
| Method | Description |
|---|---|
| EnvelopeCenter | Returns the center point of the bounding circle for a geography instance. |
| EnvelopeAngle | Returns the maximum angle between the center point and a point in the geography instance, measured in degrees. |
These methods provide access to rings in a geography Polygon instance.
| Method | Description |
|---|---|
| NumRing | Returns the total number of rings in a Polygon geography instance. |
| RingN | Returns the specified ring of a Polygon geography instance. |
These methods perform advanced spatial relationship queries.
| Method | Description |
|---|---|
| ShortestLineTo (geography Data Type) | Returns a LineString instance with two points representing the shortest distance between the two geography instances. |
These methods provide detailed validity checking and type information.
| Method | Description |
|---|---|
| IsValidDetailed (geography Data Type) | Returns a message that helps identify problems with an invalid geography instance. |
| MakeValid | Converts an invalid geography instance into a valid instance with a valid OGC type. |
| InstanceOf | Returns 1 if a geography instance is of the specified type. |
| IsNull | Returns 1 if a geography instance is null. |
These methods perform spatial operations with enhanced capabilities.
| Method | Description |
|---|---|
| Filter | Offers a fast, index-only intersection method to determine if a geography instance intersects another instance. |
| ReorientObject | Returns a geography instance with interchanged interior and exterior regions (reverses ring orientation). |
These methods provide information about SQL Server version compatibility.
| Method | Description |
|---|---|
| MinDbCompatibilityLevel (geography Data Type) | Returns the minimum database compatibility level that recognizes the geography data type. |