Returns the GML representation of an ST_Geometry value.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsGML()
The following example returns the result <Point srsName="EPSG:4326"><coordinates>1,2</coordinates></Point>.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsGML('GML(Version=2)')
The following returns the result <gml:Point srsName="EPSG:4326"><gml:coordinates>1,2</gml:coordinates></gml:Point>. The Namespace=global parameter provides a dedicated ("gml") prefix for the given element and its sub elements. This is useful when the query is used within an aggregate operation, such that, some top level element defines the namespace for the "gml" prefix.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsGML('GML(Version=2;Namespace=global)')
The following returns the result <Point srsName="EPSG:4326"><coordinates>1,2</coordinates></Point>. No namespace information is included in the output.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsGML('GML(Version=2;Namespace=none)')
The following returns the result <Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><coordinates>1,2</coordinates></Point>. The long format of the srsName attribute is used.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsGML('GML(Version=2;Namespace=none;SRSNameFormat=long)')
The following returns the result <Point srsName="urn:x-ogc:def:crs:EPSG:4326"><pos>1 2 3 4</pos></Point>. The long format of the srsName attribute is used and the format differs in version 3 from the version 2 format.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsGML('GML(Version=3;Namespace=none;SRSNameFormat=long)')
SQL/MM (ISO/IEC 13249-3: 2006) 5.1.39