This topic describes the ST_GeomFromKML function. This function constructs a geometry object by using an Open Geospatial Consortium (OGC) Keyhole Markup Language (KML) string.

Syntax

geometry  ST_GeomFromKML(text  geomkml);

Parameters

Parameter Description
geomkml The KML string that you want to specify.

Description

  • This function supports only KML geometry fragments. If you use this function on an entire KML document, this function returns an error.
  • This function supports 3D objects and does not discard the z-index of the geometry object that is constructed.

Examples

SELECT ST_AsText(ST_GeomFromKML('<Point><coordinates>116,40</coordinates></Point>'));
   st_astext
---------------
 POINT(116 40)
(1 row)