Lines Matching refs:twkb
33 * @see https://github.com/TWKB/Specification/blob/master/twkb.md
78 * @param string $twkb Tiny Well-known-binary string
85 public function read($twkb, $isHexString = false)
88 $twkb = @pack('H*', $twkb);
91 if (empty($twkb)) {
92 throw new \Exception('Cannot read empty TWKB. Found ' . gettype($twkb));
95 $this->reader = new BinaryReader($twkb);
354 $twkb = $this->writeGeometry($geometry);
356 return $writeAsHex ? current(unpack('H*', $twkb)) : $twkb;
465 $twkb = $this->writer->writeSVarInt($x - $this->lastPoint->x());
466 $twkb .= $this->writer->writeSVarInt($y - $this->lastPoint->y());
468 $twkb .= $this->writer->writeSVarInt($z - $this->lastPoint->z());
471 $twkb .= $this->writer->writeSVarInt($m - $this->lastPoint->m());
476 return $twkb;
485 $twkb = $this->writer->writeUVarInt($geometry->numPoints());
487 $twkb .= $this->writePoint($component);
489 return $twkb;
498 $twkb = $this->writer->writeUVarInt($geometry->numGeometries());
500 $twkb .= $this->writeLineString($component);
502 return $twkb;
511 $twkb = $this->writer->writeUVarInt($geometry->numGeometries());
520 $twkb .= $this->$func($component);
522 $twkb .= $this->writeGeometry($component);
525 return $twkb;