->KML
geo
conversion
The ->KML
function converts a GeoJSON STRING, a WKT STRING, a GML **STRING, WKB BYTES or a SHAPE to a KML STRING.
This function accepts an optional boolean on top of the SHAPE to choose whether all cells are outputted or not. Defaults to false.
->KML is available since version 2.9.0.
See also
Signatures
Examples
// Outputs the KML covering the GeoShape
'MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20)))'
10 false GEO.WKT
->KML
'kml_string' STORE
// Use this string to import in Google MyMaps
// Remember to remove [" and "] and unescape double quotes.
'<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Folder><Placemark>'
$kml_string +
'</Placemark></Folder></Document></kml>' +
// Outputs the KML covering the GeoShape
'MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20)))'
10 false GEO.WKT
true ->KML
'kml_string' STORE
// Use this string to import in Google MyMaps
// Remember to remove [" and "] and unescape double quotes.
'<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Folder><Placemark>'
$kml_string +
'</Placemark></Folder></Document></kml>' +