GeomFromGML (geography Data Type)

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)yesAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Constructs a geography instance given a representation in the SQL Server subset of the Geography Markup Language (GML).

For more information on GML, see the following Open Geospatial Consortium Specifications: OGC Specifications, Geography Markup Language

This geography data type method supports FullGlobe instances or spatial instances that are larger than a hemisphere.

|Applies to: SQL Server ( SQL Server 2008 through current version), Azure SQL Database.|


GeomFromGml ( GML_input, SRID )  


Is an XML input from which the GML will return a value.

Is an int expression representing the spatial reference ID (SRID) of the geography instance to return.

Return Types

SQL Server return type: geography

CLR return type: SqlGeography


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

This method will throw ArgumentException if the input contains antipodal edge.


The following example uses GeomFromGml() to create a geography instance.

DECLARE @g geography;  
DECLARE @x xml;  
SET @x = '<LineString xmlns=""><posList>47.656 -122.36 47.656 -122.343</posList></LineString>';  
SET @g = geography::GeomFromGml(@x, 4326);  
SELECT @g.ToString();  

The following example uses GeomFromGml() to create a FullGlobe``geography instance.

DECLARE @g geography;  
DECLARE @x xml;  
SET @x = '<FullGlobe xmlns="" />';  
SET @g = geography::GeomFromGml(@x, 4326);  
SELECT @g.ToString();  

See Also

Extended Static Geography Methods