rkondratuk/geo-math-php
Composer 安装命令:
composer require rkondratuk/geo-math-php
包简介
Geo calculations library
README 文档
README
PHP library for calculations in the Cartesian or polar coordinate system.
Requirements
- PHP: >=5.4
Add to composer
composer require rkondratuk/geo-math-php:^1
Example:
<?php use PhpGeoMath\Model\GeoSegment; use PhpGeoMath\Model\Cartesian3dPoint; use PhpGeoMath\Model\Polar3dPoint; /* * Create polar point (in polar coordinates) */ // Rockefeller center coordinates $latitude = 40.758742779050706; $longitude = -73.97855507715238; $polarPoint1 = new Polar3dPoint( $latitude, $longitude, Polar3dPoint::EARTH_RADIUS_IN_METERS ); // Empire State Building coordinates $polarPoint2 = new Polar3dPoint( 40.74843388072615, -73.98566565776102, Polar3dPoint::EARTH_RADIUS_IN_METERS ); // The Morgan Library & Museum coordinates $polarPoint3 = new Polar3dPoint( 40.74919365249446, -73.98133456388013, Polar3dPoint::EARTH_RADIUS_IN_METERS ); /* * Create cartesian point (in cartesian coordinates) */ $x = 1001; $y = 205; $z = 512; $cartesianPoint1 = new Cartesian3dPoint($x, $y, $z); /* * Convert coordinates in alternative coordinates system */ $convertedCartesianPoint1 = $polarPoint1->buildCartesian3DPoint(); $convertedPolarPoint1 = $cartesianPoint1->buildPolar3dPoint(); /* * Calc GEO distance (by GEO arc) between two points */ $geoDistance = $polarPoint2->calcGeoDistanceToPoint($polarPoint1); /* * Calc the nearest point (point-x) from GEO segment [point-1, point-2] to some GEO point (3) * Point (point-x) placed between [point-1, point-2] */ $arcSegmentFirst = new GeoSegment($polarPoint1, $polarPoint2); $nearestPolarPointX = $arcSegmentFirst->calcNearestPoint($polarPoint3); /* * Shortest distance from point-3 to segment [point-1, point-2] * is distance between point-3 and point-x */ $nearestGeoDistance = $nearestPolarPointX->calcGeoDistanceToPoint($polarPoint3); // Use Earth radius in miles for calculations in miles Polar3dPoint::EARTH_RADIUS_IN_MILES;
Bitcoin address for donates: bc1qwa5wmta36e8a2wrvpa9jyplgzg4pjad7grwm29
rkondratuk/geo-math-php 适用场景与选型建议
rkondratuk/geo-math-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.09k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 10 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「geo」 「mathematics」 「coordinates」 「polar」 「cartesian」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rkondratuk/geo-math-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rkondratuk/geo-math-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rkondratuk/geo-math-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Get distance between two locations using PHP.
Mathematical functions with strict typing and predictable error handling
Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.
Show geo marker on a mapbox map
Show geo shape on a mapbox map with drawing capabilities
Add a weather widget to Flarum
统计信息
- 总下载量: 5.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-14