SQL Flow Field Guide

geography: OGC Methods on Geography Instances

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

none (documentation, rules or examples)

What changes

Input
none
Output or change
none

Syntax at a glance

n/a (reference page)

Work example

Use geography methods for standard shape measurements, predicates, and conversions.

Choose a method from its result and test boundaries with a matching SRID.

Check your work The OGC geography methods use round-earth coordinates; distance is in metres and both inputs use SRID 4326.

Practice SQL

Open in SQL Flow

Open the SQL for a walkthrough. Run the example in SQL Server to check its result.

SELECT a.shape.STDistance(b.shape) AS distance_metres, a.shape.STIntersects(b.shape) AS intersects, a.shape.STSrid AS source_srid FROM (VALUES (geography::Point(47.651, -122.349, 4326))) AS a(shape) CROSS JOIN (VALUES (geography::Point(47.656, -122.343, 4326))) AS b(shape);

Open Microsoft Learn for full syntax, permissions, and details for your version.