The ST_AsGML method returns a GML string representing the geometry. A number of different formats are supported (with associated
options) and the desired format is selected using the optional format parameter. If the format parameter is not specified, the default is 'GML'.

The format string defines an output format and parameters to the format. The format string has one of the following formats:

format-name

format-name(parameter1=value1;parameter2=value2;...)

parameter1=value1;parameter2=value2;...

The first format specifies the format name and no parameters. All format parameters use their default values. The second
format specifies the format name and a list of named parameter values. Parameters that are not supplied use their default
values. The last format specifies only parameter values, and the format name defaults to 'GML'.

The following format names may be used:

GML The Geography Markup Language format defined by ISO 19136 and the OGC.

The following format parameters can be specified:

Format Name

Parameter Name

Default Value

Allowed Values

Description

GML

Namespace

none

local Provides a default namespace attribute for the given element (in this case Point) and its sub elements.

global 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.

none Provides no namespace or prefix for the given element (in this case Point) and its sub elements

The namespace parameter specifies the output format convention for namespace.

GML

SRSNameFormat

short

short Uses a short format for the spatial reference system name, for example EPSG:4326

long Uses a long format for the spatial reference system name, for example urn:x-ogc:def:crs:EPSG:4326.

none Spatial reference system name attribute is not included for the geometry.

The SRSNameFormat parameter specifies the format for the srsName attribute.

GML

SRSDimension

No

Yes or No

The SRSDimension parameter specifies the number of coordinate values for the given geometry. This only applies to GML(version=3).

GML

SRSFillAll

No

Yes or No

The SRSFillAll parameter specifies whether or not SRS attributes should be propagated to child geometry elements. As an example
a MultiGeometry or MultiPolygon would propagate the attributes to its child geometries.

GML

UseDeprecated

No

Yes or No

The UseDeprecated parameter only applies to GML(version=3). It is used to output older GML representations where possible.
As an example a Surface may be output as a Polygon if the geometry contains no CircularStrings.

GML

Attribute

Automatically generated optional attributes

One or more attributes may be specified for the top level geometry element only

Any legal XML attributes may be specified.

GML

SubElement

Automatically generated GML sub elements

One or more sub elements may be specified for the top level geometry element only

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.

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.