geography.STLength
spatial method STLength (instance.STLength(...))
What changes
- Input
- spatial instance (and arguments)
- Output or change
- float
- Return type
- SQL Server return type: float CLR return type: SqlDouble
Syntax at a glance
.STLength ( )
Work example
Use geography.STLength to measure the length of curve elements.
For geometry record coordinate units. For geography check SRID units. Keep the geography type and SRID in the review.
Check your work The route length is measured in metres for this geography instance.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
SELECT r.shape.STLength() AS route_length_metres FROM (VALUES (geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326))) AS r(shape);
Open Microsoft Learn for full syntax, permissions, and details for your version.