chiyoyo/distance

Calculate the distance between 2 points.

0.0.1 2023-10-30 02:39 UTC

This package is auto-updated.

Last update: 2024-08-30 01:27:32 UTC


README

PHPCS PHPMD Test

Overview

Calculate the distance between 2 locations.

Installation

composer require chiyoyo/distance

Usage

// Coordinate Object
$coordinate1 = new Coordinate($latitude1, $longitude1);
$coordinate2 = new Coordinate($latitude2, $longitude2);

// Hybeny Distance Formula
$distance = Distance::hybeny($coordinate1, $coordinate2);

// Spherical Trigonometry
$distance = Distance::sphericalTrigonometry($coordinate1, $coordinate2);

// Geodesic Sailing
$distance = Distance::geodesicSailing($coordinate1, $coordinate2);

Features

Find the distance (in meters) between two points using the following method.

Author

Kouji Chihara