You are here

protected function GeoRSS::parsePolygons in geoPHP 8

Same name and namespace in other branches
  1. 7 geoPHP/lib/adapters/GeoRSS.class.php \GeoRSS::parsePolygons()
1 call to GeoRSS::parsePolygons()
GeoRSS::geomFromXML in geoPHP/lib/adapters/GeoRSS.class.php

File

geoPHP/lib/adapters/GeoRSS.class.php, line 120

Class

GeoRSS
PHP Geometry/GeoRSS encoder/decoder

Code

protected function parsePolygons() {
  $polygons = array();
  $poly_elements = $this->xmlobj
    ->getElementsByTagName('polygon');
  foreach ($poly_elements as $poly) {
    if ($poly
      ->hasChildNodes()) {
      $points = $this
        ->getPointsFromCoords(trim($poly->firstChild->nodeValue));
      $exterior_ring = new LineString($points);
      $polygons[] = new Polygon(array(
        $exterior_ring,
      ));
    }
    else {

      // It's an EMPTY polygon
      $polygons[] = new Polygon();
    }
  }
  return $polygons;
}