Share via


SqlGeometry.STDistance Method

Returns the shortest distance between a point in a SqlGeometry instance and a point in the specified SqlGeometry instance.

Namespace:  Microsoft.SqlServer.Types
Assembly:  Microsoft.SqlServer.Types (in Microsoft.SqlServer.Types.dll)

Syntax

'Declaration
<SqlMethodAttribute(IsDeterministic := True, IsPrecise := False)> _
Public Function STDistance ( _
    other As SqlGeometry _
) As SqlDouble
'Usage
Dim instance As SqlGeometry
Dim other As SqlGeometry
Dim returnValue As SqlDouble

returnValue = instance.STDistance(other)
[SqlMethodAttribute(IsDeterministic = true, IsPrecise = false)]
public SqlDouble STDistance(
    SqlGeometry other
)
[SqlMethodAttribute(IsDeterministic = true, IsPrecise = false)]
public:
SqlDouble STDistance(
    SqlGeometry^ other
)
[<SqlMethodAttribute(IsDeterministic = true, IsPrecise = false)>]
member STDistance : 
        other:SqlGeometry -> SqlDouble
public function STDistance(
    other : SqlGeometry
) : SqlDouble

Parameters

Return Value

Type: System.Data.SqlTypes.SqlDouble
A SqlDouble value that represents the shortest distance between a point in the calling SqlGeometry and a point in the specified SqlGeometry.

Remarks

STDistance always returns null if the spatial reference IDs (SRIDs) of the SqlGeometry instances do not match.

See Also

Reference

SqlGeometry Class

Microsoft.SqlServer.Types Namespace