You are here

function WKB::writePolygon in geoPHP 8

Same name and namespace in other branches
  1. 7 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 218

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;
}