zishang520 / spatial by luoyy

php coordinate calculation component
164
0
2
Package Data
Maintainer Username: luoyy
Maintainer Contact: zishang520@gmail.com (luoyy)
Package Create Date: 2021-08-17
Package Last Update: 2023-04-14
Language: PHP
License: Unknown
Last Refreshed: 2024-12-19 03:13:44
Package Statistics
Total Downloads: 164
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

坐标相关的组件

安装包

composer require luoyy/spatial

Quick Sample Usage

/**
 * DEMO
 */
use luoyy\Spatial\Spatial;
use luoyy\Spatial\Support\LineString;
use luoyy\Spatial\Support\Point;
use luoyy\Spatial\Support\Polygon;
use luoyy\Spatial\Transform;

var_dump(Transform::transform(new Point(180, 90), Transform::WGS84, Transform::GCJ02));
var_dump(Spatial::ringArea(new Polygon(new Point(116.169465, 39.932670), new Point(116.160260, 39.924492), new Point(116.150625, 39.710019), new Point(116.183198, 39.709920), new Point(116.226950, 39.777616), new Point(116.442621, 39.799892), new Point(116.463478, 39.790066), new Point(116.588276, 39.809551), new Point(116.536091, 39.808859), new Point(116.573856, 39.839643), new Point(116.706380, 39.916740), new Point(116.600293, 39.937770), new Point(116.514805, 39.982375), new Point(116.499935, 40.013710), new Point(116.546520, 40.030443), new Point(116.687668, 40.129961), new Point(116.539697, 40.080659), new Point(116.503390, 40.058474), new Point(116.468800, 40.052578))));
var_dump(Spatial::distance(new Point(116.169465, 39.932670), new Point(116.160260, 39.924492)));
var_dump(Spatial::lineDistance(new LineString(new Point(116.169465, 39.932670), new Point(116.160260, 39.924492), new Point(116.150625, 39.710019), new Point(116.183198, 39.709920), new Point(116.226950, 39.777616), new Point(116.442621, 39.799892), new Point(116.463478, 39.790066), new Point(116.588276, 39.809551), new Point(116.536091, 39.808859), new Point(116.573856, 39.839643), new Point(116.706380, 39.916740), new Point(116.600293, 39.937770), new Point(116.514805, 39.982375), new Point(116.499935, 40.013710), new Point(116.546520, 40.030443), new Point(116.687668, 40.129961), new Point(116.539697, 40.080659), new Point(116.503390, 40.058474), new Point(116.468800, 40.052578))));