Happy New Year and Merry Christmas!
- Dec 30, 2022
During the implementation of one interesting project (related to GPS navigation), the data comes to the server from GPS in the nmea format. And the coordinates, in turn, for use in the web need additional processing.
I leave a small gist coordinate transformation in the php language.
During the implementation of one interesting project (related to GPS navigation), the data comes to the server from GPS in the nmea format. And the coordinates, in turn, for use in the web need additional processing.
I leave a small gist coordinate transformation in the php language.
/**
* Перевод координат nmea в градусы
*
* @param $nmeagps
* @return float|int
*/
static public function nmeaCoordinatesToDouble($nmeagps)
{
$intDeg = (int) ($nmeagps/100);
$result = $intDeg + ($nmeagps - 100*$intDeg)/60;
return $result;
}
class Test{
function test() {
self::nmeaCoordinatesToDouble(5501.2346); //результат 55.020576666667
}
}
All Comments (0)