https://github.com/janu-software/gps
Tool for working with GPS points.
https://github.com/janu-software/gps
coordinates distance geolocation gps nette php
Last synced: 4 months ago
JSON representation
Tool for working with GPS points.
- Host: GitHub
- URL: https://github.com/janu-software/gps
- Owner: janu-software
- License: mit
- Created: 2019-05-16T05:55:53.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-06-03T10:53:44.000Z (11 months ago)
- Last Synced: 2025-11-27T10:45:11.699Z (5 months ago)
- Topics: coordinates, distance, geolocation, gps, nette, php
- Language: PHP
- Homepage:
- Size: 91.8 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# GPS
GPS Point with useful detection and method.
[](https://github.com/janu-software/gps/actions/workflows/composer.yml)
[](https://github.com/janu-software/gps/actions/workflows/code_style.yml)
[](https://github.com/janu-software/gps/actions/workflows/tester.yml)
[](https://github.com/janu-software/gps/actions/workflows/static_analysis.yml)
[](https://packagist.org/packages/stanislav-janu/gps)
[](https://packagist.org/packages/stanislav-janu/gps)
[](https://packagist.org/packages/stanislav-janu/gps)
[](https://coveralls.io/github/janu-software/gps?branch=master)
## Installation
composer require stanislav-janu/gps
## Compatibility
| Version | PHP | Nette Utils |
|---------|------|-------------|
| 4.0 | ^8.3 | ^4.0 |
| 3.0 | ^8.0 | ^4.0 |
| 2.1 | ^8.0 | ^3.2 |
| 2.0 | ^8.0 | ^3.0 |
| 1.1 | ^7.1 | ^2.4 ^3.0 |
| 1.0 | ^7.0 | ^2.4 |
## Usage
```php
use JanuSoftware\GPS\GpsPoint;
use JanuSoftware\GPS\GpsPointException;
try {
$point = GpsPoint::from('49°3\'6.630"N, 14°26\'7.763"E');
echo $point; // 49.0518417, 14.4354897
echo $point->lat; // 49.0518417
echo $point->lng; // 14.4354897
} catch (GpsPointException $exception) {
echo $exception->getMessage();
}
```
### Accepted formats:
* OpenStreetMap URL
* Google Maps URL
* Mapy.com URL
* 49°3'6.630"N, 14°26'7.763"E
* N 49°3.11050', E 14°26.12938'
* 49.0518417N, 14.4354897E
* 49.0518417N,14.4354897E
* 49.0518417, 14.4354897
* 49.0518417,14.4354897
* 49.0518417 14.4354897
* -47.338388,-0.990228
* -47.338388 -0.990228
### Distance
```php
$point1 = GpsPoint::from('some coordinates');
$point2 = GpsPoint::from('some coordinates');
$distance = $point1->distanceTo($point2); // distance in meters
```
### Google Maps Distance Matrix
```php
...
$distance = $point1->distanceTo($point2, 'Google Maps API key'); // distance in meters
```