diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-10-24 22:27:30 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-10-24 22:27:30 +1300 |
commit | 6e1b6dc596e50fe0460abbc252540674c72153b1 (patch) | |
tree | afd65939b7246a4ab5fc1ccc735200a104c0df8d | |
parent | 91d94457e0a8eedf9824bb2c1e1bce4864308352 (diff) | |
download | trackermap-server-6e1b6dc596e50fe0460abbc252540674c72153b1.tar.gz trackermap-server-6e1b6dc596e50fe0460abbc252540674c72153b1.tar.bz2 trackermap-server-6e1b6dc596e50fe0460abbc252540674c72153b1.zip |
Correctly decode negative coords (fix #2479)
-rw-r--r-- | src/org/traccar/helper/Parser.java | 2 | ||||
-rw-r--r-- | test/org/traccar/protocol/WatchProtocolDecoderTest.java | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/helper/Parser.java b/src/org/traccar/helper/Parser.java index dcea1c8f7..2f99d6e49 100644 --- a/src/org/traccar/helper/Parser.java +++ b/src/org/traccar/helper/Parser.java @@ -155,7 +155,7 @@ public class Parser { } if (hemisphere != null && (hemisphere.equals("S") || hemisphere.equals("W") || hemisphere.equals("-"))) { - coordinate = -coordinate; + coordinate = -Math.abs(coordinate); } return coordinate; diff --git a/test/org/traccar/protocol/WatchProtocolDecoderTest.java b/test/org/traccar/protocol/WatchProtocolDecoderTest.java index 6116c2c2b..25d4f7cc2 100644 --- a/test/org/traccar/protocol/WatchProtocolDecoderTest.java +++ b/test/org/traccar/protocol/WatchProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class WatchProtocolDecoderTest extends ProtocolTest { WatchProtocolDecoder decoder = new WatchProtocolDecoder(new WatchProtocol()); verifyPosition(decoder, text( + "[3G*6430073509*00E7*UD2,241016,081622,V,09.951861,N,-84.1422119,W,0.00,0.0,0.0,0,39,94,0,0,00000000,1,0,712,3,2007,18961,123,4,Luz,00:23:6a:34:ee:76,-70,familia,b0:c5:54:b9:90:ef,-78,fam salas delgado,fc:b4:e6:5d:50:ea,-81,QWERTY,c8:3a:35:43:0f:e8,-93")); + + verifyPosition(decoder, text( "[3G*6105117105*008D*UD2,210716,231601,V,-33.480366,N,-70.7630692,E,0.00,0.0,0.0,0,100,34,0,0,00000000,3,255,730,2,29731,54315,167,29731,54316,162,29731,54317,145"), position("2016-07-21 23:16:01.000", false, -33.48037, -70.76307)); |