You are here

public function KML::collectionToKML in geoPHP 8

Same name and namespace in other branches
  1. 7 geoPHP/lib/adapters/KML.class.php \KML::collectionToKML()
1 call to KML::collectionToKML()
KML::geometryToKML in geoPHP/lib/adapters/KML.class.php

File

geoPHP/lib/adapters/KML.class.php, line 248

Class

KML
PHP Geometry/KML encoder/decoder

Code

public function collectionToKML($geom) {
  $components = $geom
    ->getComponents();
  $str = '<' . $this->nss . 'MultiGeometry>';
  foreach ($geom
    ->getComponents() as $comp) {
    $sub_adapter = new KML();
    $str .= $sub_adapter
      ->write($comp);
  }
  return $str . '</' . $this->nss . 'MultiGeometry>';
}