You are here

function WKB::writePolygon in geoPHP 7

Same name and namespace in other branches
  1. 8 geoPHP/lib/adapters/WKB.class.php \WKB::writePolygon()
2 calls to WKB::writePolygon()
EWKB::write in geoPHP/lib/adapters/EWKB.class.php
Serialize geometries into an EWKB binary string.
WKB::write in geoPHP/lib/adapters/WKB.class.php
Serialize geometries into WKB string.

File

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

Class

WKB
PHP Geometry/WKB encoder/decoder

Code

function writePolygon($poly) {

  // Set the number of lines in this poly
  $wkb = pack('L', $poly
    ->numGeometries());

  // Write the lines
  foreach ($poly
    ->getComponents() as $line) {
    $wkb .= $this
      ->writeLineString($line);
  }
  return $wkb;
}