You are here

public function Collection::boundary in geoPHP 7

Same name and namespace in other branches
  1. 8 geoPHP/lib/geometry/Collection.class.php \Collection::boundary()

Overrides Geometry::boundary

3 methods override Collection::boundary()
GeometryCollection::boundary in geoPHP/lib/geometry/GeometryCollection.class.php
LineString::boundary in geoPHP/lib/geometry/LineString.class.php
Polygon::boundary in geoPHP/lib/geometry/Polygon.class.php

File

geoPHP/lib/geometry/Collection.class.php, line 129

Class

Collection
Collection: Abstract class for compound geometries

Code

public function boundary() {
  if ($this
    ->isEmpty()) {
    return new LineString();
  }
  if ($this
    ->geos()) {
    return $this
      ->geos()
      ->boundary();
  }
  $components_boundaries = array();
  foreach ($this->components as $component) {
    $components_boundaries[] = $component
      ->boundary();
  }
  return geoPHP::geometryReduce($components_boundaries);
}