예제 #1
0
파일: WKBReader.php 프로젝트: brick/geo
 /**
  * @param string  $wkb  The WKB to read.
  * @param integer $srid The optional SRID of the geometry.
  *
  * @return Geometry
  *
  * @throws GeometryIOException
  */
 public function read($wkb, $srid = 0)
 {
     $buffer = new WKBBuffer($wkb);
     $geometry = $this->readGeometry($buffer, $srid);
     if (!$buffer->isEndOfStream()) {
         throw GeometryIOException::invalidWKB('unexpected data at end of stream');
     }
     return $geometry;
 }
예제 #2
0
파일: WKBBuffer.php 프로젝트: brick/geo
 /**
  * Reads the machine byte order from the buffer and stores the result to act accordingly.
  *
  * @throws GeometryIOException
  */
 public function readByteOrder()
 {
     $byteOrder = $this->readUnsignedChar();
     if ($byteOrder !== WKBTools::BIG_ENDIAN && $byteOrder !== WKBTools::LITTLE_ENDIAN) {
         throw GeometryIOException::invalidWKB('unknown byte order: ' . $byteOrder);
     }
     $this->invert = $byteOrder !== $this->machineByteOrder;
 }