
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
- /
- 1236
Popular
Install, configure Sphinx 3.0.3
- Aug 14, 2019
SkeekS CMS 5.5.11 release works with yii2 2.0.24
- Aug 13, 2019
How to generate yii2 migrations from a database?
- Jun 24, 2019
All Comments (0)