Skip to content

Commit

Permalink
Add lat and lng in dmm
Browse files Browse the repository at this point in the history
  • Loading branch information
lgaticaq committed Feb 11, 2016
1 parent f000c31 commit 1c5e7c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ data.raw // '$GPRMC,161006.425,A,7855.6020,S,13843.8900,E,154.89,84.62,110715,17
data.type // 'RMC'
data.gps // true
data.datetime // Sat Jul 11 2015 13:10:06 GMT-0300 (CLT)
data.loc // { type: 'Point', coordinates: [ 138.7315, -78.9267 ] }
data.loc // { geojson: { type: 'Point', coordinates: [ 138.7315, -78.9267 ] }, dmm: { latitude: '7855.6020,S', longitude: '13843.8900,E' } }
data.speed // { knots: 154.89, kmh: 286.85627999999997 }
data.track // '84.62'
data.magneticVariation // '173.1,W'
Expand Down
16 changes: 11 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,17 @@ const parse = (raw) => {
data.type = r[1];
data.datetime = moment(`${r[8]}${r[2]}+00:00`, 'DDMMYYHHmmss.SSSZZ').toDate();
data.loc = {
type: 'Point',
coordinates: [
degToDec(r[5]),
degToDec(r[4])
]
geojson: {
type: 'Point',
coordinates: [
degToDec(r[5]),
degToDec(r[4])
]
},
dmm: {
latitude: r[4],
longitude: r[5]
}
};
data.gps = r[3] === 'A';
data.speed = {
Expand Down

0 comments on commit 1c5e7c1

Please sign in to comment.