PHP code example of geo-io / wkt-parser
1. Go to this page and download the library: Download geo-io/wkt-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
geo-io / wkt-parser example snippets
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)');