You are here

public function Collection::area in geoPHP 8

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

Overrides Geometry::area

2 methods override Collection::area()
LineString::area in geoPHP/lib/geometry/LineString.class.php
Polygon::area in geoPHP/lib/geometry/Polygon.class.php

File

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

Class

Collection
Collection: Abstract class for compound geometries

Code

public function area() {
  if ($this
    ->geos()) {
    return $this
      ->geos()
      ->area();
  }
  $area = 0;
  foreach ($this->components as $component) {
    $area += $component
      ->area();
  }
  return $area;
}