Skip to content

Repository files navigation

GPS

GPS Point with useful detection and method.

ComposerCode styleTesterPhpStan

Latest Stable VersionTotal DownloadsLicenseCoverage Status

Installation

composer require stanislav-janu/gps

Compatibility

VersionPHPNette 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

useJanuSoftware\GPS\GpsPoint;
useJanuSoftware\GPS\GpsPointException;
try {
$point = GpsPoint::from('49°3\'6.630"N, 14°26\'7.763"E');
echo$point; // 49.0518417, 14.4354897echo$point->lat; // 49.0518417echo$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

$point1 = GpsPoint::from('some coordinates');
$point2 = GpsPoint::from('some coordinates');
$distance = $point1->distanceTo($point2); // distance in meters

Google Maps Distance Matrix

...$distance = $point1->distanceTo($point2, 'Google Maps API key'); // distance in meters

About

Tool for working with GPS points.

Topics

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages