geography.AsGml
spatial method AsGml (instance.AsGml(...))
What changes
- Input
- spatial instance (and arguments)
- Output or change
- xml
- Return type
- SQL Server return type: xml CLR return type: SqlXml
Syntax at a glance
.AsGml ( )
Work example
Use geography.AsGml to export GML for a spatial exchange.
Check GML version, namespace, axis order, and coordinate reference. Keep the geography type and SRID in the review.
Check your work The XML is a GML LineString with the route coordinates in the EPSG:4326 axis order.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
SELECT r.shape.AsGml() AS route_gml FROM (VALUES (geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326))) AS r(shape);
Open Microsoft Learn for full syntax, permissions, and details for your version.