longitude-one/spatial-types

这个库实现了PHP空间类型:它们的接口及其几何和地理类。

0.0.1.alpha 2024-08-08 13:08 UTC

This package is auto-updated.

Last update: 2024-09-08 13:27:22 UTC


README

实现空间PHP类型及其几何和地理类。

如果您想在数据库中持久化空间数据,应使用 longitude-one/doctrine2-spatial 包。

当前状态

longitude-one/spatial--types Stable release Minimum PHP Version Packagist License

Last integration test Last integration test Maintainability Downloads Coverage Status

安装

composer require longitude-one/spatial-types

使用

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