Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 1.86 KB

parse-geometry-data-type.md

File metadata and controls

57 lines (41 loc) · 1.86 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords dev_langs
Parse (geometry Data Type)
Parse (geometry Data Type)
MladjoA
mlandzic
08/03/2017
sql
t-sql
reference
Parse (geometry Data Type)
TSQL

Parse (geometry Data Type)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance]

Returns a geometry instance from an Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation. Parse() is equivalent to STGeomFromText(), with the exception that it assumes a spatial reference ID (SRID) of 0 as a parameter. The input may carry optional Z (elevation) and M (measure) values.

Syntax

  
Parse ( 'geometry_tagged_text' )  

Arguments

geometry_tagged_text
Is the WKT representation of the geometry instance you wish to return. geometry_tagged_text is an nvarchar expression.

Return Types

[!INCLUDEssNoVersion] return type: geometry

CLR return type: SqlGeometry

Remarks

The OGC type of the geometry instance returned by Parse() is set to the corresponding WKT input.

The string 'Null' will be interpreted as a null geometry instance.

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

Examples

The following example uses Parse() to create a geometry instance.

DECLARE @g geometry;   
SET @g = geometry::Parse('LINESTRING (100 100, 20 180, 180 180)');  
SELECT @g.ToString();  

See Also

STGeomFromText
Extended Static Geometry Methods