PHPackages                             ixnode/php-gpx-reader - 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. ixnode/php-gpx-reader

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

ixnode/php-gpx-reader
=====================

PHP GPX Reader - A versatile library for reading GPX files and efficiently retrieving GPS coordinates based on timestamps.

0.1.3(1y ago)110MITPHPPHP ^8.2

Since Dec 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ixnode/php-gpx-reader)[ Packagist](https://packagist.org/packages/ixnode/php-gpx-reader)[ RSS](/packages/ixnode-php-gpx-reader/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (14)Versions (5)Used By (0)

PHP GPX Reader
==============

[](#php-gpx-reader)

[![Release](https://camo.githubusercontent.com/831eb5eda1c25acf860d0150acec4578bbb4b888fb9ad304eaa563e8fa6bd40c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f69786e6f64652f7068702d6770782d726561646572)](https://github.com/ixnode/php-gpx-reader/releases)[![](https://camo.githubusercontent.com/e4b3a2013dff3ad2a60a503304bc14571cf0db9cc6b06675291d5586d393b9f8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f69786e6f64652f7068702d6770782d726561646572)](https://github.com/ixnode/php-gpx-reader/releases)[![](https://camo.githubusercontent.com/83b003b0abe22805dbe2c725237b38e71c72dedaaa68700c80699d7e22091add/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f69786e6f64652f7068702d6770782d7265616465722e737667)](https://camo.githubusercontent.com/83b003b0abe22805dbe2c725237b38e71c72dedaaa68700c80699d7e22091add/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f69786e6f64652f7068702d6770782d7265616465722e737667)[![PHP](https://camo.githubusercontent.com/9ffda6c94e9634fafbd5ff0f68f442ccb690a9b88c8613f79b9c2ec14f5e596b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e322d3737376262332e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d353535353535267374796c653d666c6174)](https://www.php.net/supported-versions.php)[![PHPStan](https://camo.githubusercontent.com/29fcb055286f72da2b9c961f987152d1ac26a91d6cea221174abe7e01b5b7857/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c2532304d61782d3737376262332e7376673f7374796c653d666c6174)](https://phpstan.org/user-guide/rule-levels)[![PHPUnit](https://camo.githubusercontent.com/de101a446df383674178b80c404288664983cc6de751737d976d3df023942af9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f504850556e69742d556e697425323054657374732d3662396264322e7376673f7374796c653d666c6174)](https://phpunit.de)[![PHPCS](https://camo.githubusercontent.com/ee1fdc76b568e414c96c160eb608dd4680475a67d714661b70a3b3c43f6ded54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50485043532d50535231322d3431366434652e7376673f7374796c653d666c6174)](https://www.php-fig.org/psr/psr-12/)[![PHPMD](https://camo.githubusercontent.com/223a2afede2bd4bf4d524b7610277838a5d75504f7087fc6c36847b81a80ab43/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048504d442d414c4c2d3336346138332e7376673f7374796c653d666c6174)](https://github.com/phpmd/phpmd)[![Rector - Instant Upgrades and Automated Refactoring](https://camo.githubusercontent.com/9c119c037099401c8a61bd1ce556a58158eb09bfe452b2d132b94500e6368714/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f526563746f722d504850253230382e322d3733613136352e7376673f7374796c653d666c6174)](https://github.com/rectorphp/rector)[![LICENSE](https://camo.githubusercontent.com/e5ea4c19422baff789692dd36ee83fc11b6dc67d211dd4a56b4c721e509e8b27/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f69786e6f64652f7068702d6170692d76657273696f6e2d62756e646c65)](https://github.com/ixnode/php-api-version-bundle/blob/master/LICENSE)

> PHP GPX Reader - A versatile library for reading GPX files and efficiently retrieving GPS coordinates based on timestamps.

The PHP GPX Reader is a lightweight and powerful tool to find the nearest GPS coordinate from a GPX file based on a specific timestamp. While it's perfect for photo geotagging (e.g., matching photo timestamps to GPS data), the tool can be used in many other scenarios where time-based GPS data needs to be processed.

1. Features
-----------

[](#1-features)

- Reads GPX files and retrieves the closest GPS coordinate to a given timestamp.
- Efficiently handles GPX tracks with multiple points.
- Allows precise time matching to find the nearest location.
- Supports time offset adjustments for scenarios where the reference time is inaccurate.
- Flexible and easy to integrate for different use cases.

2. Usage
--------

[](#2-usage)

```
use Ixnode\PhpGpxReader\GpxReader;

...

$gpxReader = new GpxReader($fileObject);

/* Set time gap from camera time: The clock goes ahead. */
$gpxReader->setTimeGapFromString('-00:13:00');

/* Set (real) time to search. */
$gpxReader->setDateTimeFromString('2024-05-05 13:04:16', new DateTimeZone(Timezones::EUROPE_BERLIN));

/* Get the closest coordinate from GPX file. */
$coordinate = $gpxReader->getCoordinate();

/* Time difference to next point. */
print $gpxReader->getTimeDifference();
// (int) 5

/* Latitude to the closest point. */
print $coordinate->getLatitude();
// (float) 47.099262

/* Longitude to the closest point. */
print $coordinate->getLongitude();
// (float) 9.942202

/* Google maps link. */
print $coordinate->getLinkGoogle().PHP_EOL;
// (string) https://www.google.de/maps/place/47.099262+9.942202
```

3. Installation
---------------

[](#3-installation)

```
composer require ixnode/php-gpx-reader
```

```
vendor/bin/php-gpx-reader -V
```

```
0.1.0 (2024-12-07 19:00:00) - Björn Hempel
```

4. Command line tool
--------------------

[](#4-command-line-tool)

### 4.1 Search for the closest point with given taken time

[](#41-search-for-the-closest-point-with-given-taken-time)

> Search for the closest point within a gpx file with given date and camera time gap.

```
bin/console gpx:read data/gpx/2024-05-05.gpx --date="2024-05-05 13:04:16" --gap="\-00:13:00"
```

or within your composer project:

```
vendor/bin/php-gpx-reader gpx:read data/gpx/2024-05-05.gpx --date="2024-05-05 13:04:16" --gap="\-00:13:00"
```

```
Time to search:   05.05.2024 10:51:16 UTC
Time difference:  5s
Coordinate:       lat=47.099262; lon=9.942202
Coordinate:       47.099262, 9.942202
Google link:      https://www.google.de/maps/place/47.099262+9.942202
```

### 4.2 Search for the closest point with given image (to read the taken time)

[](#42-search-for-the-closest-point-with-given-image-to-read-the-taken-time)

> Search for the closest point within a gpx file with given date and camera time gap.

```
bin/console gpx:read data/gpx/2024-05-05.gpx --image="data/image/example-basic.jpg" --gap="\-00:13:00"
```

or within your composer project:

```
vendor/bin/php-gpx-reader gpx:read data/gpx/2024-05-05.gpx --image="data/image/example-basic.jpg" --gap="\-00:13:00"
```

```
Time to search:   05.05.2024 10:51:17 UTC
Time difference:  4s
Coordinate:       lat=47.099251; lon=9.942342
Coordinate:       47.099251, 9.942342
Google link:      https://www.google.de/maps/place/47.099251+9.942342
```

5. Library development
----------------------

[](#5-library-development)

```
git clone git@github.com:ixnode/php-gpx-reader.git && cd php-gpx-reader
```

```
composer install
```

```
composer test
```

6. License
----------

[](#6-license)

This library is licensed under the MIT License - see the [LICENSE](/LICENSE) file for details.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

527d ago

PHP version history (2 changes)0.1.0PHP ^8.3

0.1.2PHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![bjoern-hempel](https://avatars.githubusercontent.com/u/5531245?v=4)](https://github.com/bjoern-hempel "bjoern-hempel (7 commits)")

---

Tags

phptimestampcoordinategpxcameratime-correctiontime-gap

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ixnode-php-gpx-reader/health.svg)

```
[![Health](https://phpackages.com/badges/ixnode-php-gpx-reader/health.svg)](https://phpackages.com/packages/ixnode-php-gpx-reader)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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