phpgpsd
What is this?: phpgpsd was written with the intention of providing a simple to use class for including geolocation data provided by GPSd to web applications. As of the most current version, phpgpsd implements methods that provide most of the data that GPSd is capable of providing (some of the more, shall we say, esoteric data that GPSd can provide has been left out in the interest of maximizing the use of my limited free time - I need to save some for cartoons!).
At this time, phpgpsd implements the following public methods:
- getAltitude
- getBaudRate
- getByteSize
- getCardinalDirection
- getDate
- getDeviceName
- getDeviceType
- getDOP
- getFixType
- getHorizontalError
- getLatitude
- getLongitude
- getNMEAStatus
- getParity
- getSatellites
- getSpeed
- getStopBits
- getTotalError
- getTrack
- getVerticalError
- has2DFix
- has3DFix
- hasFix
Here’s an example usage:
getAltitude(METERS)."m / ".$gps->getAltitude(FEET)."f\n";
echo "Latitude: ".$gps->getLatitude()."°\n";
echo "Longitude: ".$gps->getLongitude()."°\n";
echo "Track: ".$gps->getTrack()."\n";
echo "Direction: ".$gps->getCardinalDirection()."\n";
echo "Device Name: ".$gps->getDeviceName()."\n";
echo "Device Type: ".$gps->getDeviceType()."\n";
echo "NMEA Status: ".$gps->getNMEAStatus()."\n";
echo "Baud Rate: ".$gps->getBaudRate()."\n";
echo "Parity: ".$gps->getParity()."\n";
echo "Byte Size: ".$gps->getByteSize()."\n";
echo "Stop Bits: ".$gps->getStopBits()."\n";
echo "Date / Time: ".$gps->getDate("r")."\n";
echo "Total Position Errors: ".$gps->getTotalError()."m / ".$gps->getTotalError(FEET)."f\n";
echo "Horizontal Error: ".$gps->getHorizontalError()."m / ".$gps->getHorizontalError(FEET)."f\n";
echo "Vertical Error: ".$gps->getVerticalError()."m / ".$gps->getVerticalError(FEET)."f\n";
echo "No. of Satellites: ".$gps->getSatellites()."\n";
echo "Speed: ".$gps->getSpeed(KPH)."kph ".$gps->getSpeed(MPH)."mph";