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
| Parameter | Type | Description |
geomgml | text | The GML string. |
srid | integer | The 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
srsNameattribute, 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)该文章对您有帮助吗?