Skip to content

geo-io/wkt-parser

Repository files navigation

Geo I/O WKT Parser

Build Status Coverage Status

A parser which transforms Well-known text (WKT) representations into geometric objects.

class MyFactory implements GeoIO\Factory
{
    public function createPoint($dimension, array $coordinates, $srid = null)
    {
        return MyPoint($coordinates['x'], $coordinates['y']);
    }

    public function createLineString($dimension, array $points, $srid = null)
    {
        return MyLineString($points);
    }

    // ...
}

$factory = MyFactory();
$parser = new GeoIO\WKT\Parser\Parser($factory);

$myLineString = $parse->parse('LINESTRING(1 2, 2 2, 1 1)');

Installation

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

composer require geo-io/wkt-parser

License

Copyright (c) 2014-2022 Jan Sorgalla. Released under the MIT License.