ST_GeomFromGML

更新时间: 2026-03-28 02:37:46

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

ParameterTypeDescription
geomgmltextThe GML string.
sridintegerThe spatial reference identifier (SRID) of the geometry object.

Usage notes

  • Accepts GML geometry fragments only. Passing an entire GML document returns an error.
  • Does not support mixed dimensions. If no Z coordinate is found, the function converts the geometry to 2D geometry.
  • Does not support mixed spatial reference systems (SRS). All sub-geometries are reprojected to the SRS of the root node. If the GML root node has no srsName attribute, the function returns an error.
  • 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)
上一篇: ST_GeomFromGeoHash 下一篇: ST_GeomFromGeoJSON
阿里云首页 云原生数据库 PolarDB 相关技术圈