https://github.com/geo-io/wkt-parser
Well-known text (WKT) Parser.
https://github.com/geo-io/wkt-parser
geo geography geometry parser spatial wkt
Last synced: 3 months ago
JSON representation
Well-known text (WKT) Parser.
- Host: GitHub
- URL: https://github.com/geo-io/wkt-parser
- Owner: geo-io
- License: mit
- Created: 2014-02-11T21:39:42.000Z (over 12 years ago)
- Default Branch: main
- Last Pushed: 2022-01-20T09:49:11.000Z (over 4 years ago)
- Last Synced: 2026-03-04T23:49:55.876Z (4 months ago)
- Topics: geo, geography, geometry, parser, spatial, wkt
- Language: PHP
- Homepage:
- Size: 39.1 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Geo I/O WKT Parser
==================
[](https://github.com/geo-io/wkt-parser/actions/workflows/ci.yml)
[](https://coveralls.io/github/geo-io/wkt-parser?branch=main)
A parser which transforms
[Well-known text (WKT)](http://en.wikipedia.org/wiki/Well-known_text)
representations into geometric objects.
```php
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](http://getcomposer.org). Check the
[packagist page](https://packagist.org/packages/geo-io/wkt-parser) for all
available versions.
```bash
composer require geo-io/wkt-parser
```
License
-------
Copyright (c) 2014-2022 Jan Sorgalla. Released under the [MIT License](LICENSE).