You are here

public function GeometryCollection::asArray in geoPHP 8

Same name and namespace in other branches
  1. 7 geoPHP/lib/geometry/GeometryCollection.class.php \GeometryCollection::asArray()

Overrides Collection::asArray

File

geoPHP/lib/geometry/GeometryCollection.class.php, line 14

Class

GeometryCollection
GeometryCollection: A heterogenous collection of geometries

Code

public function asArray() {
  $array = array();
  foreach ($this->components as $component) {
    $array[] = array(
      'type' => $component
        ->geometryType(),
      'components' => $component
        ->asArray(),
    );
  }
  return $array;
}