public function KML::polygonToKML in geoPHP 8
Same name and namespace in other branches
- 7 geoPHP/lib/adapters/KML.class.php \KML::polygonToKML()
1 call to KML::polygonToKML()
- KML::geometryToKML in geoPHP/
lib/ adapters/ KML.class.php
File
- geoPHP/
lib/ adapters/ KML.class.php, line 236
Class
- KML
- PHP Geometry/KML encoder/decoder
Code
public function polygonToKML($geom) {
$components = $geom
->getComponents();
if (!empty($components)) {
$str = '<' . $this->nss . 'outerBoundaryIs>' . $this
->linestringToKML($components[0], 'LinearRing') . '</' . $this->nss . 'outerBoundaryIs>';
foreach (array_slice($components, 1) as $comp) {
$str .= '<' . $this->nss . 'innerBoundaryIs>' . $this
->linestringToKML($comp) . '</' . $this->nss . 'innerBoundaryIs>';
}
}
return '<' . $this->nss . 'Polygon>' . $str . '</' . $this->nss . 'Polygon>';
}