You are here

private function GeoRSS::polygonToGeoRSS in geoPHP 8

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

File

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

Class

GeoRSS
PHP Geometry/GeoRSS encoder/decoder

Code

private function polygonToGeoRSS($geom) {
  $output = '<' . $this->nss . 'polygon>';
  $exterior_ring = $geom
    ->exteriorRing();
  foreach ($exterior_ring
    ->getComponents() as $k => $point) {
    $output .= $point
      ->getY() . ' ' . $point
      ->getX();
    if ($k < $exterior_ring
      ->numGeometries() - 1) {
      $output .= ' ';
    }
  }
  $output .= '</' . $this->nss . 'polygon>';
  return $output;
}