luoyy/spatial
php coordinate calculation component
239
Larablocks Analysis
luoyy/spatial works with any PHP project: the latest release (v3.0.5, Jul 9, 2026) doesn't depend on Laravel.
Recommendation checks
PromisingPromising: maintained and up to date, meets 1 of 3 checks; not yet widely used.
- Released in the last 12 months (Jul 9, 2026)
- 1 downloads a month (needs 10,000)
- 0 GitHub stars (needs 100)
State
Maintained- Last stable release: Jul 9, 2026.
- 1 release in the last 12 months.
- First released: Aug 17, 2021.
- Monthly downloads: 1.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.
| Install | |
|---|---|
composer require luoyy/spatial |
|
| Latest Version: | v3.0.5 |
| PHP: | >=8.1.0 |
| Last Updated: | Jul 9, 2026 |
| Links: | GitHub · Packagist |
Maintainer: luoyy
坐标相关的组件
安装包
composer require luoyy/spatial
Quick Sample Usage
/**
* DEMO
*/
use luoyy\Spatial\Spatial;
use luoyy\Spatial\Support\LineString;
use luoyy\Spatial\Support\PointWGS84; // WGS84
use luoyy\Spatial\Support\Polygon;
use luoyy\Spatial\Transform;
use luoyy\Spatial\Enums\CoordinateSystemEnum;
var_dump(Transform::transform(new PointWGS84([180, 90]), CoordinateSystemEnum::GCJ02));
var_dump((new PointWGS84([180, 90]))->transform(CoordinateSystemEnum::GCJ02));
var_dump(Spatial::ringArea(new Polygon([[new PointWGS84([116.169465, 39.932670]), new PointWGS84([116.160260, 39.924492]), new PointWGS84([116.150625, 39.710019]), new PointWGS84([116.183198, 39.709920]), new PointWGS84([116.226950, 39.777616]), new PointWGS84([116.442621, 39.799892]), new PointWGS84([116.463478, 39.790066]), new PointWGS84([116.588276, 39.809551]), new PointWGS84([116.536091, 39.808859]), new PointWGS84([116.573856, 39.839643]), new PointWGS84([116.706380, 39.916740]), new PointWGS84([116.600293, 39.937770]), new PointWGS84([116.514805, 39.982375]), new PointWGS84([116.499935, 40.013710]), new PointWGS84([116.546520, 40.030443]), new PointWGS84([116.687668, 40.129961]), new PointWGS84([116.539697, 40.080659]), new PointWGS84([116.503390, 40.058474]), new PointWGS84([116.468800, 40.052578]), new PointWGS84([116.169465, 39.932670])]])));
var_dump(Spatial::distance(new PointWGS84([116.169465, 39.932670]), new PointWGS84([116.160260, 39.924492])));
var_dump(Spatial::lineDistance(new LineString([new PointWGS84([116.169465, 39.932670]), new PointWGS84([116.160260, 39.924492]), new PointWGS84([116.150625, 39.710019]), new PointWGS84([116.183198, 39.709920]), new PointWGS84([116.226950, 39.777616]), new PointWGS84([116.442621, 39.799892]), new PointWGS84([116.463478, 39.790066]), new PointWGS84([116.588276, 39.809551]), new PointWGS84([116.536091, 39.808859]), new PointWGS84([116.573856, 39.839643]), new PointWGS84([116.706380, 39.916740]), new PointWGS84([116.600293, 39.937770]), new PointWGS84([116.514805, 39.982375]), new PointWGS84([116.499935, 40.013710]), new PointWGS84([116.546520, 40.030443]), new PointWGS84([116.687668, 40.129961]), new PointWGS84([116.539697, 40.080659]), new PointWGS84([116.503390, 40.058474]), new PointWGS84([116.468800, 40.052578])])));
Related Packages
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| v3.0.5 | >=8.1.0 | ||
| v3.0.4 | >=8.1.0 | ||
| v3.0.3 | >=8.1.0 | ||
| v3.0.2 | >=8.1.0 | ||
| v3.0.1 | >=8.1.0 | ||
| v3.0.0 | >=8.1.0 | ||
| v2.3.6 | >=8.1.0 | ||
| v2.3.5 | >=8.1.0 | ||
| v2.3.4 | >=8.1.0 | ||
| v2.3.3 | >=8.1.0 | ||
| v2.3.2 | >=8.1.0 | ||
| v2.3.1 | >=8.1.0 | ||
| v2.3.0 | >=8.1.0 | ||
| v2.2.3 | >=8.1.0 | ||
| v2.2.1 | >=8.1.0 | ||
| v2.2.0 | >=8.1.0 | ||
| v2.1.8 | >=8.1.0 | ||
| v2.1.7 | >=8.1.0 | ||
| v2.1.6 | >=8.1.0 | ||
| v2.1.5 | >=8.1.0 | ||
| v2.1.4 | >=8.1.0 | ||
| v2.1.3 | >=8.1.0 | ||
| v2.1.2 | >=8.1.0 | ||
| v2.1.1 | >=8.1.0 | ||
| v2.1.0 | >=8.1.0 | ||
| v2.0.4 | >=8.1.0 | ||
| v2.0.3 | >=8.1.0 | ||
| v2.0.2 | >=8.1.0 | ||
| v2.0.1 | >=8.1.0 | ||
| v2.0.0 | >=8.1.0 |
Showing the latest 30 of 48. See every release on Packagist