- Timestamp:
- Sep 21, 2017, 4:05:40 PM (9 years ago)
- Branches:
- debian/bullseye, debian/jessie
- Children:
- d3bfa78
- Parents:
- 36a36bf (diff), 9773514 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Rmc.php
r36a36bf recee2e6 55 55 $this->_status = Nmea0183RmcStatus::A; 56 56 57 $this->_latitude = (float)$content[3];57 $this->_latitude = Nmea0183Rmc::nmeaToDecimalDegrees($content[3]); 58 58 if(Nmea0183Rmc::directionToEnum($content[4]) == Nmea0183Direction::South) 59 59 $this->_latitude = $this->_latitude * -1; 60 60 61 $this->_longitude = (float)$content[5];61 $this->_longitude = Nmea0183Rmc::nmeaToDecimalDegrees($content[5]); 62 62 if(Nmea0183Rmc::directionToEnum($content[6]) == Nmea0183Direction::West) 63 63 $this->_longitude = $this->_longitude * -1; … … 162 162 } 163 163 164 private static function nmeaToDecimalDegrees($nmeaValue) 165 { 166 if((float)$nmeaValue == 0) 167 return 0; 168 169 $matches = array(); 170 $result = preg_match('/^([0-9]+)([0-9]{2}\.[0-9]+)$/', $nmeaValue, $matches); 171 if($result === false || $result != 1 || count($matches) != 3){ 172 $message = "Could not convert nmea position into decimal degress ". $nmeaValue; 173 error_log($message); 174 if($debug > 0) 175 print $message ."\n"; 176 return 0; 177 } 178 $decimalDegrees = (float)$matches[1]; 179 $decimalMinutes = (float)$matches[2]; 180 return $decimalDegrees + ($decimalMinutes / 60.0); 181 } 182 164 183 private $_dateTimeUtc; 165 184 private $_status;
Note:
See TracChangeset
for help on using the changeset viewer.
