SQL Flow Field Guide

geography::GeomFromGML

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

static constructor GeomFromGML (called as type::GeomFromGML(...))

What changes

Input
WKT, WKB, GML or coordinates and SRID
Output or change
spatial instance
Return type
SQL Server return type: geography CLR return type: SqlGeography

Syntax at a glance

GeomFromGml ( GML_input, SRID )

Work example

Use geography.GeomFromGML to construct a spatial value from GML markup.

Validate namespace, coordinate order, and SRID before import. Keep the geography type and SRID in the review.

Check your work The input is SQL Server supported GML with EPSG:4326 latitude, longitude axis order.

Practice SQL

Open in SQL Flow

Open the SQL for a walkthrough. Run the example in SQL Server to check its result.

SELECT geography::GeomFromGml(CONVERT(xml, N'<LineString xmlns="http://www.opengis.net/gml"><posList>47.656 -122.36 47.656 -122.343</posList></LineString>'), 4326).STAsText() AS route_wkt;

Open Microsoft Learn for full syntax, permissions, and details for your version.