/** * @dataProvider providerTextBinary * * @param string $text The WKT of the geometry under test. * @param string $bigEndianBinary The big endian WKB of the geometry under test. * @param string $littleEndianBinary The little endian WKB of the geometry under test. */ public function testFromBinary($text, $bigEndianBinary, $littleEndianBinary) { foreach ([$bigEndianBinary, $littleEndianBinary] as $binary) { $geometry = Geometry::fromBinary(hex2bin($binary)); $this->assertSame($text, $geometry->asText()); $this->assertSame(0, $geometry->SRID()); $geometry = Geometry::fromBinary(hex2bin($binary), 4326); $this->assertSame($text, $geometry->asText()); $this->assertSame(4326, $geometry->SRID()); } }
/** * Loads the underlying geometry. * * @return void * * @throws GeometryIOException If the proxy data is not valid. * @throws CoordinateSystemException If the resulting geometry contains mixed coordinate systems. * @throws InvalidGeometryException If the resulting geometry is not valid. * @throws UnexpectedGeometryException If the resulting geometry is not an instance of the proxied class. */ private function load() { $this->proxyGeometry = $this->proxyIsBinary ? Geometry::fromBinary($this->proxyData, $this->proxySRID) : Geometry::fromText($this->proxyData, $this->proxySRID); }