geometry::Parse
static constructor Parse (called as type::Parse(...))
What changes
- Input
- WKT, WKB, GML or coordinates and SRID
- Output or change
- spatial instance
- Return type
- SQL Server return type: geometry CLR return type: SqlGeometry
Syntax at a glance
Parse ( 'geometry_tagged_text' )
Work example
Use geometry.Parse to construct a spatial instance from Well-Known Text.
Choose geometry or geography and set the intended SRID. Keep the geometry type and SRID in the review.
Check your work Parse creates a point with SRID 0. X=3 and Y=4 are synthetic planar coordinates.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
-- Planar geometry. SRID 0 coordinates here are synthetic units, not metres.
DECLARE @result geometry;
SET @result = geometry::Parse(N'POINT(3 4)');
SELECT @result.STAsText() AS parsed_point,
@result.STSrid AS result_srid,
@result.STIsValid() AS result_is_valid;
Open Microsoft Learn for full syntax, permissions, and details for your version.