PHP code example of longitude-one / spatial-types

1. Go to this page and download the library: Download longitude-one/spatial-types 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/ */

    

longitude-one / spatial-types example snippets


use LongitudeOne\Spatial\Types\Geometry\Point;

$point = new Point(1, 2);
echo $point->getX(); // 1
echo $point->getY(); // 2

$lineString = new LineString([
    new Point(1, 2),
    new Point(3, 4),
    new Point(5, 6),
], 4326);
$lineString->getSrid(); // 4326