You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns the shortest distance between a point in a **geography** instance and a point in another **geography** instance.
29
-
30
-
> [!NOTE]
31
-
> `STDistance()` returns the shortest **LineString** between two geography types. This is a close approximate to the geodesic distance. The deviation of `STDistance()` on common earth models from the exact geodesic distance is no more than .25%. This avoids confusion over the subtle differences between length and distance in geodesic types.
32
-
33
-
## Syntax
34
-
35
-
```
36
-
37
-
.STDistance ( other_geography )
38
-
```
39
-
40
-
## Arguments
41
-
*other_geography*
42
-
Is another **geography** instance from which to measure the distance between the instance on which STDistance() is invoked. If *other_geography* is an empty set, STDistance() returns null.
STDistance() always returns null if the spatial reference IDs (SRIDs) of the **geography** instances do not match.
51
-
52
-
> [!NOTE]
53
-
> Methods on the **geography** data type that calculate an area or distance will return different results based on the SRID of the instance used in the method. For more information about SRIDs, see [Spatial Reference Identifiers (SRIDs)](../../relational-databases/spatial/spatial-reference-identifiers-srids.md).
54
-
55
-
## Examples
56
-
The following example finds the distance between two **geography** instances.
57
-
58
-
```
59
-
DECLARE @g geography;
60
-
DECLARE @h geography;
61
-
SET @g = geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326);
62
-
SET @h = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326);
63
-
SELECT @g.STDistance(@h);
64
-
```
65
-
66
-
## See Also
67
-
[OGC Methods on Geography Instances](../../t-sql/spatial-geography/ogc-methods-on-geography-instances.md)
68
-
69
-
28
+
Returns the shortest distance between a point in a **geography** instance and a point in another **geography** instance.
29
+
30
+
> [!NOTE]
31
+
> `STDistance()` returns the shortest **LineString** between two geography types. This is a close approximate to the geodesic distance. The deviation of `STDistance()` on common earth models from the exact geodesic distance is no more than .25%. This avoids confusion over the subtle differences between length and distance in geodesic types.
32
+
33
+
## Syntax
34
+
35
+
```
36
+
37
+
.STDistance ( other_geography )
38
+
```
39
+
40
+
## Arguments
41
+
*other_geography*
42
+
Is another **geography** instance from which to measure the distance between the instance on which STDistance() is invoked. If *other_geography* is an empty set, STDistance() returns null.
STDistance() always returns null if the spatial reference IDs (SRIDs) of the **geography** instances do not match.
51
+
52
+
> [!NOTE]
53
+
> Methods on the **geography** data type that calculate an area or distance will return different results based on the SRID of the instance used in the method. For more information about SRIDs, see [Spatial Reference Identifiers (SRIDs)](../../relational-databases/spatial/spatial-reference-identifiers-srids.md).
54
+
55
+
## Examples
56
+
The following example finds the distance between two **geography** instances.
57
+
58
+
```
59
+
DECLARE @g geography;
60
+
DECLARE @h geography;
61
+
SET @g = geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326);
62
+
SET @h = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326);
63
+
SELECT @g.STDistance(@h);
64
+
```
65
+
66
+
## See Also
67
+
[OGC Methods on Geography Instances](../../t-sql/spatial-geography/ogc-methods-on-geography-instances.md)
0 commit comments