Nome

ST_AsKML — Return the geometry as a KML element.

Sinossi

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

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

Descrizione

Return the geometry as a Keyhole Markup Language (KML) element. default maximum number of decimal places is 15, default namespace is no prefix.

[Avvertimento]

Using the maxdecimaldigits parameter can cause output geometry to become invalid. To avoid this use ST_ReducePrecision with a suitable gridsize first.

Availability: 1.2.2 - later variants that include version param came in 1.3.2

Enhanced: 2.0.0 - Add prefix namespace, use default and named args

Changed: 3.0.0 - Removed the "versioned" variant signature

[Nota]

Requires PostGIS be compiled with Proj support. Use PostGIS_Full_Version to confirm you have proj support compiled in.

[Nota]

AsKML output will not work with geometries that do not have an SRID

Questa funzione supporta il 3d e non distrugge gli z-index.

Esempi

Code
SELECT ST_AsKML(ST_GeomFromText('POLYGON((0 0,0 1,1 1,1 0,0 0))', 4326));
Output
<Polygon
><outerBoundaryIs
><LinearRing
><coordinates
>0,0 0,1 1,1 1,0 0,0</coordinates
></LinearRing
></outerBoundaryIs
></Polygon
>

This example outputs a 3D LineString.

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

Si veda anche

ST_AsSVG, ST_AsGML