This topic describes the ST_GeomFromGML function. This function constructs a geometry object by using a Geography Markup Language (GML) string.

Syntax

geometry  ST_GeomFromGML(text  geomgml);
geometry  ST_GeomFromGML(text  geomgml , integer  srid);

Parameters

Parameter Description
geomgml The GML string that you want to specify.
srid The spatial reference identifier (SRID) of the geometry object.

Description

  • This function supports only GML geometry fragments. If you use this function on an entire GML document, this function returns an error.
  • GML supports mixed dimensions. This function does not support mixed dimensions. If no z coordinate is found, this function converts the geometry object that is constructed into a 2D object.
  • GML supports mixed spatial reference systems (SRSs). This function does not support mixed SRSs. This function reprojects all sub-geometries to the SRS root node. If no srsName attribute is available for the GML root node, this function returns an error.
  • This function supports polyhedral surfaces, triangles, triangulated irregular network (TIN) surfaces, and 3D objects.

Examples

SELECT ST_AsText(ST_GeomFromGML('<gml:Point srsName="EPSG:4326"><gml:coordinates>116,40</gml:coordinates></gml:Point>'));
   st_astext
---------------
 POINT(116 40)
(1 row)