geo-io/wkt-generator

Well-known text (WKT) Generator.

v1.0.0 2015-04-17 19:05 UTC

This package is auto-updated.

Last update: 2021-07-05 11:21:44 UTC


README

Build Status Coverage Status

Generates Well-known text (WKT) 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\WKT\Generator\Generator($extractor);

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

Installation

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

composer require geo-io/wkt-generator

License

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