Share via


SqlGeography.STGeomFromText Method

Returns a SqlGeography instance from an Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation augmented with any Z (elevation) and M (measure) values carried by the instance.

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

Syntax

'Declaration
<SqlMethodAttribute(IsDeterministic := True, IsPrecise := False)> _
Public Shared Function STGeomFromText ( _
    geometryTaggedText As SqlChars, _
    srid As Integer _
) As SqlGeography
'Usage
Dim geometryTaggedText As SqlChars
Dim srid As Integer
Dim returnValue As SqlGeography

returnValue = SqlGeography.STGeomFromText(geometryTaggedText, _
    srid)
[SqlMethodAttribute(IsDeterministic = true, IsPrecise = false)]
public static SqlGeography STGeomFromText(
    SqlChars geometryTaggedText,
    int srid
)
[SqlMethodAttribute(IsDeterministic = true, IsPrecise = false)]
public:
static SqlGeography^ STGeomFromText(
    SqlChars^ geometryTaggedText, 
    int srid
)
[<SqlMethodAttribute(IsDeterministic = true, IsPrecise = false)>]
static member STGeomFromText : 
        geometryTaggedText:SqlChars * 
        srid:int -> SqlGeography
public static function STGeomFromText(
    geometryTaggedText : SqlChars, 
    srid : int
) : SqlGeography

Parameters

  • srid
    Type: System.Int32
    An int expression that represents the spatial reference ID (SRID) of the SqlGeography instance you wish to return.

Return Value

Type: Microsoft.SqlServer.Types.SqlGeography
A SqlGeography instance constructed from the WKY representation.

Remarks

The OGC type of the SqlGeography instance returned by STGeomFromText is set to the corresponding WKT input.

This method will throw a FormatException if the input is not well-formatted.

See Also

Reference

SqlGeography Class

Microsoft.SqlServer.Types Namespace