FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
2,497 views 2 comments
by

Hello,

I'm programming a small app to communicate with RUT955 GPS service. I'm following the protocol based in UDP link.

My question is regarding the data value received for the longitude and latitude. In the example provided in the link;

https://wiki.teltonika.lt/index.php?title=RUT955_Protocols

We can show a position for:

0E3BD4A5 – Longitude 23.8802085 = 23.8802085 º N

20B53DC3 – Latitude 54.8748739 = 54.8748739 º E

Where I can see and example data for the same Longitude and Latitude but for the South and West? I would like to compare and avoid any missunderstanding.

Thank you!!!

1 Answer

0 votes
by anonymous

Hello,

Is this what you need:

087C16D8 - Longitude 14.2350040 = 14.601440 ° S

1EF32B54 - Latitude 51.9252820 = 51.9252820 ° W

Best answer
by
Hello,

This is my doubt...

If you describe 14.601440ºS like 087C16D8.... How is represented 14.601440ºN?

I don't catch the relation byte to byte ...
by anonymous

Ok, looks like I misunderstood.

If longitude is in South or latitude in West, multiply the result by –1 (for decimals). So the initial example, but for South and West, would be:

Longitude -23.8802085 = 23.8802085 º S

Latitude -54.8748739 = 54.8748739 º W

The way you get hex values is called "sixteen's complement". To get that value, you'd first have to convert the number to two's complement signed binary. So if you take the number 23.8802085 º S and convert it to binary, you get:

00001110 00111011 11010100 10100101

(I've added the extra zeros in front because longitude and latitude coordinate values take up 4 bytes each and 1 byte consists of 8 bits. So the four zeros that I added "complete" the byte and will be necessary later). Now you invert the values and add 1:

11110001 11000100 00101011 01011011

Now convert the value to hex and you get:

F1C42B5B - Longitude -23.8802085 = 23.8802085 º S

For the West value:

54.8748739 → 00100000 10110101 00111101 11000011 → 11011111 01001010 11000010 00111101 → DF4AC23D

So the final results:

F1C42B5B - Longitude -23.8802085 = 23.8802085 º S
DF4AC23D - Latitude -54.8748739 = 54.8748739 º W

Should be a piece of cake when converting with code as the binary step will probably not be necessary. I hope this helps!