PHPackages                             javidalpe/spherical-geometry - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. javidalpe/spherical-geometry

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

javidalpe/spherical-geometry
============================

This library provides classes and functions for the computation of geometric data on the surface of the Earth. Code ported from the Google Maps API.

07PHP

Since Jun 17Pushed 7y ago1 watchersCompare

[ Source](https://github.com/javidalpe/spherical-geometry)[ Packagist](https://packagist.org/packages/javidalpe/spherical-geometry)[ RSS](/packages/javidalpe-spherical-geometry/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Spherical Geometry
==================

[](#spherical-geometry)

This library provides classes and functions for the computation of geometric data on the surface of the Earth. Code ported from the Google Maps API.

### Install

[](#install)

Require this package with composer using the following command:

```
composer require javidalpe/spherical-geometry
```

### API

[](#api)

**SphericalUtil::computeHeading**

Returns the heading from one LatLng to another LatLng. Headings are expressed in degrees clockwise from North within the range \[-180,180).

**SphericalUtil::computeOffset**

Returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north).

**SphericalUtil::computeOffsetOrigin**

Returns the location of origin when provided with a LatLng destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available.

**SphericalUtil::interpolate**

Returns the LatLng which lies the given fraction of the way between the origin LatLng and the destination LatLng.

**SphericalUtil::computeAngleBetween**

Returns the angle between two LatLngs, in radians. This is the same as the distance on the unit sphere.

**SphericalUtil::computeDistanceBetween**

Returns the distance between two LatLngs, in meters.

**SphericalUtil::computeLength**

Returns the length of the given $path, in meters, on Earth.

**SphericalUtil::computeArea**

Returns the area of a closed $path on Earth.

**SphericalUtil::computeSignedArea**

Returns the signed area of a closed path on Earth. The sign of the area may be used to determine the orientation of the path. "inside" is the surface that does not contain the South Pole.

### License

[](#license)

The Spherical Geometry is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cfc9c78a0ee3561bec8a3ed0d5ababa31ccb90703dc5ed11fd89e06e74f0b243?d=identicon)[javidalpe](/maintainers/javidalpe)

---

Top Contributors

[![javidalpe](https://avatars.githubusercontent.com/u/5345952?v=4)](https://github.com/javidalpe "javidalpe (5 commits)")

---

Tags

coordinatesdistance-calculationheadingslatitude-and-longitudemapsspherical-geometry

### Embed Badge

![Health badge](/badges/javidalpe-spherical-geometry/health.svg)

```
[![Health](https://phpackages.com/badges/javidalpe-spherical-geometry/health.svg)](https://phpackages.com/packages/javidalpe-spherical-geometry)
```

###  Alternatives

[spatie/laravel-analytics

A Laravel package to retrieve Google Analytics data.

3.2k5.7M57](/packages/spatie-laravel-analytics)[spatie/period

Complex period comparisons

1.7k4.0M10](/packages/spatie-period)[contributte/di

Extra contrib to nette/di

465.8M18](/packages/contributte-di)[slince/composer-registry-manager

Composer mirrors manager

56314.9k](/packages/slince-composer-registry-manager)[hyva-themes/magento2-graphql-tokens

Adds Customer and Cart tokens to CustomerData sections

242.6M2](/packages/hyva-themes-magento2-graphql-tokens)[kenepa/banner

Displays a informative banner to users

9430.1k2](/packages/kenepa-banner)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
