You are here

protected function GeoRSS::parseBoxes in geoPHP 7

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

File

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

Class

GeoRSS
PHP Geometry/GeoRSS encoder/decoder

Code

protected function parseBoxes() {
  $polygons = array();
  $box_elements = $this->xmlobj
    ->getElementsByTagName('box');
  foreach ($box_elements as $box) {
    $parts = explode(' ', trim($box->firstChild->nodeValue));
    $components = array(
      new Point($parts[3], $parts[2]),
      new Point($parts[3], $parts[0]),
      new Point($parts[1], $parts[0]),
      new Point($parts[1], $parts[2]),
      new Point($parts[3], $parts[2]),
    );
    $exterior_ring = new LineString($components);
    $polygons[] = new Polygon(array(
      $exterior_ring,
    ));
  }
  return $polygons;
}