Name

ST_AsKML — 将几何图形作为KML元素返回。

Synopsis

text ST_AsKML(geometry geom, integer maxdecimaldigits=15, text nprefix=NULL);

text ST_AsKML(geography geog, integer maxdecimaldigits=15, text nprefix=NULL);

描述

将几何图形作为Keyhole标记语言(KML)元素返回。默认最大小数位数为15,默认命名空间为无前缀。

[Warning]

使用 最大小数位数 参数可能会导致输出几何图形无效。为了避免这种使用 ST_ReducePrecision 首先要有一个合适的网格大小。

[Note]

需要在支持项目的情况下编译PostGIS。使用 PostGIS_Full_Version 以确认您已编译了项目支持。

[Note]

可用性:1.2.2-1.3.2中包含版本参数的更高版本

[Note]

增强:2.0.0-添加前缀命名空间,使用默认和命名参数

[Note]

已更改:3.0.0-删除了“Versioned”变体签名

[Note]

AsKML输出将不适用于没有SRID的几何

This function supports 3d and will not drop the z-index.

示例

SELECT ST_AsKML(ST_GeomFromText('POLYGON((0 0,0 1,1 1,1 0,0 0))',4326));

                st_askml
                --------
                <Polygon><outerBoundaryIs><LinearRing><coordinates>0,0 0,1 1,1 1,0 0,0</coordinates></LinearRing></outerBoundaryIs></Polygon>

                --3d linestring
                SELECT ST_AsKML('SRID=4326;LINESTRING(1 2 3, 4 5 6)');
                <LineString><coordinates>1,2,3 4,5,6</coordinates></LineString>
                
                

另请参阅

ST_AsSVG, ST_AsGML