geometry: Extended Static Geometry Methods
none (documentation, rules or examples)
What changes
- Input
- none
- Output or change
- none
Syntax at a glance
n/a (reference page)
Work example
Use geometry methods for construction from coordinates, text, markup, or binary input.
Choose input format and SRID, then validate type and coordinate order.
Check your work GML imports a planar line and Parse builds an SRID 0 point. Both fixtures are checked for validity.
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 @gml xml;
SET @gml = N'<LineString xmlns=''http://www.opengis.net/gml''><posList>0 0 3 4</posList></LineString>';
DECLARE @from_gml geometry;
SET @from_gml = geometry::GeomFromGml(@gml, 0);
DECLARE @from_text geometry;
SET @from_text = geometry::Parse(N'POINT(3 4)');
SELECT @from_gml.STAsText() AS gml_line,
@from_text.STAsText() AS parsed_point,
@from_gml.STIsValid() AS gml_is_valid,
@from_text.STIsValid() AS parsed_is_valid;
Open Microsoft Learn for full syntax, permissions, and details for your version.