roslov/location 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

roslov/location

最新稳定版本:1.0.0

Composer 安装命令:

composer require roslov/location

包简介

Location calculator

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

This package provides calculations based on longitude and latitude.

Features

It calculates distance between two locations.

It uses the “haversine” formula to calculate the great-circle distance between two points — that is, the shortest distance over the earth’s surface — giving an “as-the-crow-flies” distance between the points.

Formula:

a = sin²( Δφ / 2 ) + cos φ1 × cos φ2 × sin²( Δλ / 2 )
c = 2 × atan2( √a, √( 1 − a ) )
d = R × c

where φ is latitude, λ is longitude, R is the earth’s radius (mean radius = 6371 km).

Requirements

  • PHP 7.2 or higher.

Installation

The package could be installed with composer:

composer require roslov/location

General usage

Validator allows to check data in any format. For example, when data is an object:

use Roslov\Location\LocationCalculator;

$locationCalculator = new LocationCalculator();
$distance = $locationCalculator->getDistance(49.841905, 24.031511, 50.450885, 30.522798);
echo $distance; // 467.32327173219

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固