geo-io/wkb-generator

Well-known binary (WKB) Generator.

v1.0.0 2015-04-17 18:57 UTC

This package is auto-updated.

Last update: 2021-07-05 11:33:14 UTC


README

Build Status Coverage Status

Generates Well-known binary (WKB) representations from geometric objects.

class MyExtractor implements GeoIO\Extractor
{
    public function extractType($geometry)
    {
        if ($geometry instanceof MyPoint) {
            return self::TYPE_POINT;
        }

        // ...
    }

    public function extractCoordinatesFromPoint($point)
    {
        return array(
            'x' => $point->getX(),
            'y' => $point->getY(),
            'z' => null,
            'm' => null,
        );
    }

    // ...
}

$extractor = MyExtractor();
$generator = new GeoIO\WKB\Generator\Generator($extractor, array(
    'hex' => true
));

echo $generator->generate(new MyPoint(1, 2));
// Outputs:
// 0101000000000000000000f03f0000000000000040

Installation

Install through composer. Check the packagist page for all available versions.

composer require geo-io/wkb-generator

License

Geo I/O WKB Generator is released under the MIT License.