You are here

function WKB::getPolygon in geoPHP 7

Same name and namespace in other branches
  1. 8 geoPHP/lib/adapters/WKB.class.php \WKB::getPolygon()
1 call to WKB::getPolygon()
WKB::getGeometry in geoPHP/lib/adapters/WKB.class.php

File

geoPHP/lib/adapters/WKB.class.php, line 118

Class

WKB
PHP Geometry/WKB encoder/decoder

Code

function getPolygon(&$mem) {

  // Get the number of linestring expected in this poly out of the first 4 bytes
  $poly_length = unpack('L', fread($mem, 4));
  $components = array();
  $i = 1;
  while ($i <= $poly_length[1]) {
    $components[] = $this
      ->getLinstring($mem);
    $i++;
  }
  return new Polygon($components);
}