ST_GeomFromGML

更新时间:
复制 MD 格式

Constructs a geometry object from a Geography Markup Language (GML) string.

Syntax

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

Parameters

ParameterDescription
geomgmlThe GML geometry fragment string.
sridThe spatial reference identifier (SRID) of the output geometry object.

Supported geometry types

  • Polyhedral surfaces

  • Triangles

  • Triangulated irregular network (TIN) surfaces

  • 3D objects

Limitations

  • GML geometry fragments only: Pass a GML geometry fragment, not a complete GML document. Passing a full GML document returns an error.

  • No mixed dimensions: GML supports mixed dimensions, but this function does not. If no Z coordinate is found, the function converts the output to a 2D object.

  • No mixed spatial reference systems (SRSs): GML supports mixed SRSs, but this function does not. The function reprojects all sub-geometries to the SRS of the root node. If the GML root node has no srsName attribute, the function returns an error.

Examples

Parse a point geometry

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

Output:

   st_astext
---------------
 POINT(116 40)
(1 row)