Geography Markup Language representation

You can generate a geometry from a Geography Markup Language (GML) representation. The GML can be represented as either GML2 (OGC GML standard 2.1.2) or GML3 (OGC GML standard 3.1.1). In addition to the two-dimensional representation supported by the Open GIS well-known binary representation, the GML representation also supports optional Z coordinates and measures.

The following functions generate a geometry from a GML string.

ST_GeomFromGML()
The function creates an ST_Geometry from a string of any geometry type.
ST_PointFromGML()
The function creates an ST_Point from a point string.
ST_LineFromGML()
The function creates an ST_LineString from a polyline string.
ST_PolyFromShape()
The function creates an ST_Polygon from a polygon string.
ST_MPointFromGML()
The function creates an ST_MultiPoint from a multipoint string.
ST_MLineFromGML()
The function creates an ST_MultiLineString from a multipart polyline string.
ST_MPolyFromGML()
The function creates an ST_MultiPolygon from a multipart polygon string.
For all of these functions, the first argument is the GML representation and the second optional argument is the spatial reference identifier to assign to the ST_Geometry. For example, the ST_GeomFromGML() function has the following syntax:
ST_GeomFromGML(gml_string, [SRID]) 

	ST_GeomFromGML('<gml:Point srsName="ESPG:1234" srsDimension="2">
     <gml:pos>10.02 20.01</gml:pos></gml:Point>', 1000)

The SE_AsGML() and ST_AsGML() functions convert the geometry value into a GML representation.

The ST_EnvelopeAsGML() function converts an ST_Polygon into a GML3 Envelope element.