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.
Php Function:
/**
* Перевод координат nmea в градусы
*
* @param $nmeagps
* @return float|int
*/
static public function nmeaCoordinatesToDouble($nmeagps)
{
$intDeg = (int) ($nmeagps/100);
$result = $intDeg + ($nmeagps - 100*$intDeg)/60;
return $result;
}
Usage example:
class Test{
function test() {
self::nmeaCoordinatesToDouble(5501.2346); //результат 55.020576666667
}
}
- Семенов Александр
- /
- Jan 11, 2019
- /
- 0
- /
- 11693
Popular
Happy New Year and Merry Christmas!
- Dec 30, 2022
SaleEvent Markup
- Nov 23, 2022
We continue to improve the tools of the online store
- Oct 27, 2022
All Comments (0)