The SE_AsGML() function

The SE_AsGML() function returns the Geography Markup Language (GML) representation of an ST_Geometry spatial type.

Typically, you use the SE_AsGML() function to retrieve the GML representation of a spatial primitive from the server and send it to a client, as in:
SELECT SE_AsGML(geomcol) FROM mytable

The return type of the SE_AsGML() function is defined as LVARCHAR. You can write user-defined routines (UDRs) in C or SPL to extend the functionality of the existing spatial data type functions. You can use the SE_AsGML() function to convert an ST_Geometry type to its GML representation.

Syntax

SE_AsGML(p ST_Geometry)

Return type

ST_Geometry

Example

In this example, the SE_AsGML() function converts the location column of the table mytable into its GML description.
CREATE TABLE mytable (id integer, location ST_Point);

INSERT INTO mytable VALUES( 
   1, 
   ST_PointFromText('point (10.02 20.01)', 1000) 
);

SELECT SE_AsGML(location) FROM mytable WHERE id = 1;

<gml:Point srsName="UNKNOWN">
<gml:coord><gml:X>10.02</gml:X><gml:Y>20.01</gml:Y></gml:coord>
</gml:Point>

The $INFORMIXDIR/extend/spatial.version/examples/gml directory contains more information about how to use an XML parser to validate the results of this function.