FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

4167 questions

4739 answers

3460 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
462 views
in Vehicle tracking by anonymous
Hi guys,

Im having an issue with south and east coordinates.

If i use the example from the document (North and West coordinates) everything works

AVLDATA: [u'0x0', u'0x0', u'0x1', u'0x3f', u'0xeb', u'0x55', u'0xff', u'0x74', u'0x0', u'0xf', u'0xe', u'0xa8', u'0x50', u'0x20', u'0x9a', u'0x69', u'0x0', u'0x0', u'0xae', u'0x0', u'0xb9', u'0xb', u'0x0', u'0x0', u'0x0', u'0x0', u'0x7', u'0xa', u'0x5', u'0x0', u'0x1', u'0x0', u'0x0', u'0x2', u'0x0', u'0x0', u'0x3', u'0x0', u'0x0', u'0x4', u'0x0', u'0x1', u'0x20', u'0x0', u'0x2', u'0x0', u'0x18', u'0x0', u'0x0', u'0x0', u'0x46', u'0x1', u'0x29', u'0x2', u'0x0', u'0xc7', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x4c', u'0x0', u'0x0', u'0x0', u'0x0', u'0x1', u'0x0', u'0x3e', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x1', u'0x5b', u'0x19', u'0x8c', u'0x74', u'0x98', u'0x0', u'0xf', u'0xd', u'0xbc', u'0x50', u'0x20', u'0x95', u'0x87', u'0x2f', u'0x0', u'0xae', u'0x0', u'0xb9', u'0xb', u'0x0', u'0x0', u'0x0', u'0x0', u'0x7', u'0xa', u'0x5', u'0x0', u'0x1', u'0x0', u'0x0', u'0x2', u'0x0', u'0x0', u'0x3', u'0x0', u'0x0', u'0x4', u'0x0', u'0x1', u'0x20', u'0x0', u'0x2', u'0x0', u'0x18', u'0x0', u'0x0', u'0x0', u'0x46', u'0x1', u'0x29', u'0x2', u'0x0', u'0xc7', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x4c', u'0x0', u'0x0', u'0x0', u'0x0', u'0x1', u'0x0', u'0x3e', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0', u'0x0']

longitude [u'0xf', u'0xe', u'0xa8', u'0x50'] 252618832 25.2618832

latitude [u'0x20', u'0x9a', u'0x69', u'0x0'] 546990336 54.6990336

But when i insert data from south/east coordinates

AVLDATA [u'0x0', u'0x0', u'0x1', u'0x70', u'0xc0', u'0xfe', u'0xd', u'0x80', u'0x0', u'0xd4', u'0x74', u'0xe6', u'0x63', u'0xea', u'0xb', u'0xd1', u'0xfd', u'0x0', u'0x17', u'0x0', u'0x0', u'0xc', u'0x0', u'0x0', u'0x0', u'0xc', u'0x5', u'0xef', u'0x0', u'0xf0', u'0x0', u'0x15', u'0x3', u'0xc8', u'0x0', u'0x45', u'0x1', u'0x5', u'0xb5', u'0x0', u'0x6', u'0xb6', u'0x0', u'0x5', u'0x42', u'0x30', u'0x81', u'0x43', u'0xf', u'0xa0', u'0x44', u'0x0', u'0x90', u'0x2', u'0xf1', u'0x0', u'0x1', u'0x1d', u'0x2a', u'0x10', u'0x0', u'0x0', u'0x1', u'0x54', u'0x0']

longitude [u'0xd4', u'0x74', u'0xe6', u'0x63'] 3564430947 -73.0536349

latitude [u'0xea', u'0xb', u'0xd1', u'0xfd'] 3926643197 -36.8324099

Im using a twosComplement method for binary, which consist in invert 0 to 1 and 1 to 0, something i find its not really clear in the documentation. The coordinate is close to the real position but not exactly the same as the one from the configurator.exe software. So in the transformation im doing somthing not exactly right but dont know what.

Thanks.

1 Answer

0 votes
by anonymous

Hello,

If longitude is in west or latitude in south, multiply result by –1. Please check Codec 8 paragraph.

https://wiki.teltonika-gps.com/view/Codec#Codec_8

Regards,

Teltonika Support.

by anonymous

Hi,

Thanks for the response. Yes i see that but i still dont understand it. What do you mean exactly when multiply by -1??

This is what i understand:

For example if i get like in the above example:

Longitude: [u'0xd4', u'0x74', u'0xe6', u'0x63'] 

This number will be the negative representation of the longitude.

When i transform that to binary: ‭(1)101 0100 0111 0100 1110 0110 0110 0011‬

in a 4 byte array, last bit will be the negative representation, in this case will be 1 so its a negative number (when 4byte representation has support for negative numbers). Is far as i understand, to transform a negative binary to a positive number we need to invert 0 to 1 and then add 1.

In this case the positive transformation

(0010 1011 1000 1011 0001 1001 1001 1100) + (000 0000 0000 0000 0000 0000 0000 0001)

That equal to:

0010 1011 1000 1011 0001 1001 1001 1101 = ‭730536349‬ then divided by 10000000 = 73,0536349‬

Finally we need to multiply by -1 => -1 * 73,0536349‬ = -73,0536349‬

This value is very close on that configurator.exe indicates, but not exacly the same, like 300m away from actual location so something im doing is not right.

Could you please help me with an example?

Thanks.

PS: I just compare this values with the Teltonika Parser and its okay. This is the way to do it. The 300 meter error was just gps bad presicion. 

by anonymous
Thank you for your detailed answer.

Could you please say which device are you testing and which firmware version it using?

Thank you in advance.

Best regards,

Teltonika Support