public static function fromBinary(string $wkb, int $srid = 0) : Geometry
    {
        static $wkbReader;

        if ($wkbReader === null) {
            $wkbReader = new WKBReader();
        }

        $geometry = $wkbReader->read($wkb, $srid);

        if (! $geometry instanceof static) {
            throw UnexpectedGeometryException::unexpectedGeometryType(static::class, $geometry);
        }

        return $geometry;
    }
public static function fromBinary(string $wkb, int $srid = 0) : Geometry
    {
        static $wkbReader;

        if ($wkbReader === null) {
            $wkbReader = new WKBReader();
        }

        $geometry = $wkbReader->read($wkb, $srid);

        if (! $geometry instanceof static) {
            throw UnexpectedGeometryException::unexpectedGeometryType(static::class, $geometry);
        }

        return $geometry;
    }
public static function fromBinary ( string $ wkb , int $ srid = 0 ) : Geometry { static $ wkbReader ; if ( $ wkbReader === null ) { $ wkbReader = new WKBReader ( ) ; } $ geometry = $ wkbReader -> read ( $ wkb , $ srid ) ; if ( ! $ geometry instanceof static ) { throw UnexpectedGeometryException :: unexpectedGeometryType ( static :: class , $ geometry ) ; } return $ geometry ; }
Builds a Geometry from a WKB representation.

If the resulting geometry is valid but is not an instance of the class this method is called on,
for example passing a Polygon WKB to Point::fromBinary(), an exception is thrown.

@param string $wkb  The Well-Known Binary representation.
@param int    $srid The optional SRID to use.

@return static

@throws GeometryIOException         If the given string is not a valid WKB representation.
@throws CoordinateSystemException   If the WKB contains mixed coordinate systems.
@throws InvalidGeometryException    If the WKB represents an invalid geometry.
@throws UnexpectedGeometryException If the resulting geometry is not an instance of the current class.
Builds a Geometry from a WKB representation .