Migrating from GPSGate

David Cole6 years ago

Looking at migrating from GPS Gate.

No real reason but that I can run Traccar on linux where gpsgate is pretty much stuck on windows.
I've been using my GPS Gate system though for a few years, so I got a fair bit of history in it. What's the easiest way of migrating that out? Individual GPX exports? or some other method?

Anton Tananaev6 years ago

I think the easiest way would be copying data directly from one database to another. You would need to know SQL though.

David Cole6 years ago

I’m pretty comfortable inside sql server, and not too bad with MySQL.

But inwouldnt have the foggiest on the schema used by either traccar or GPSGate.

I take it this hasn’t been done before?

Anton Tananaev6 years ago

I haven't done it. Not sure if anyone else tried.

In Traccar the two most important tables you are probably interested in are "devices" and "positions". Don't know about GPSGate schema.

David Cole6 years ago

So here might be another approach, I have all my terminal logs which contain:

imei:359710046258993,tracker,180118223422,,F,223422.000,A,3929.7115,S,17653.7591,E,14.43,258.35;
imei:359710046258993,tracker,180118223437,,F,223437.000,A,3929.7020,S,17653.6898,E,20.50,283.96;
imei:359710046258993,tracker,180118223452,,F,223452.000,A,3929.7028,S,17653.6313,E,4.58,257.15;
imei:359710046258993,tracker,180118223459,,F,223500.000,A,3929.6984,S,17653.6014,E,17.48,330.90;
imei:359710046258993,tracker,180118223507,,F,223507.000,A,3929.6625,S,17653.5704,E,24.66,330.88;

Is it just a matter of reading that line, and poking at it the traccar server on the xexun (my tracker was at this point), on the right port as a hex string?

Anton Tananaev6 years ago

I guess it's also an option. Your device is using GPS103 protocol, so use port 5001 in Traccar.

David Cole6 years ago

So I've made a quick python script that reads the log and sends it to the 5001 port.

Currently only sending the imei lines - which is working great (just posting a 300km trip I have logged).
Is there something traccar does with the imei number being sent by itself? I believe it's like a "hey server I'm connecting", like to break up a bunch of points into various defined trips, ie drive the car to 30 mins, it goes off line, then drive again for another 30 mins...

Or is that just handled by time differences?

Traccar log...

2018-07-06 08:06:14 DEBUG: [87731A94: 5001 < 192.168.10.210] HEX: 696d65693a3335393731303034363235383939332c747261636b65722c3138303131323232333230342c2c462c3232333230322e3030302c412c343034352e373632372c532c31373533362e343335392c452c35332e39382c3335342e30333b
2018-07-06 08:06:14  INFO: [87731A94] id: 359710046258993, time: 2018-01-13 11:32:02, lat: -40.76271, lon: 175.60727, speed: 54.0, course: 0.0
2018-07-06 08:06:15 DEBUG: [87731A94: 5001 < 192.168.10.210] HEX: 696d65693a3335393731303034363235383939332c747261636b65722c3138303131323232333231392c2c462c3232333231372e3030302c412c343034352e353435332c532c31373533362e343032342c452c35322e33312c3335332e35313b
2018-07-06 08:06:15  INFO: [87731A94] id: 359710046258993, time: 2018-01-13 11:32:17, lat: -40.75909, lon: 175.60671, speed: 52.3, course: 0.0
2018-07-06 08:06:16 DEBUG: [87731A94: 5001 < 192.168.10.210] HEX: 696d65693a3335393731303034363235383939332c747261636b65722c3138303131323232333232342c2c462c3232333232322e3030302c412c343034352e343732312c532c31373533362e333939382c452c35322e32322c332e31313b
2018-07-06 08:06:16  INFO: [87731A94] id: 359710046258993, time: 2018-01-13 11:32:22, lat: -40.75787, lon: 175.60666, speed: 52.2, course: 0.0
Anton Tananaev6 years ago

Traccar ignore those messages, so it should be fine if you don't send it.

David Cole6 years ago

Might be a real small usecase (as the gpsgate data structure was real strange, couldn't find current position data, ony old)..but would you be interested in this script? Only works if someone has turned on the gpsgate terminal logs.

Anton Tananaev6 years ago

It would be great if you can post it here for everyone in the community.

David Cole6 years ago

btw, I was on here a few years ago (and github) as psyciknz. Funnily enough when looking yesterday I found an old github issue I posted almost similar...some interaction between traccar and gpsgate

David Cole6 years ago

If I've also got a kingneed device which I've got on a different port.

Client: (864768011370522,DW5B,000,0,0,0,0,200618,220906)(864768011370522,ZC20,200618,220906,6,395,65535,1)(864768011370522,ZC20,200618,220906,6,395,65535,1)
Client: (864768011370522,DW50,000,0,0,0,0,200618,220925)(864768011370522,DW50,000,0,0,0,0,200618,220935)(864768011370522,DW50,000,0,0,0,0,200618,220945)
Client: (864768011370522,DW3B,200618,A,4113.38674S,17454.40094E,28.508,220953,188.38,-7.20,10,0)(864768011370522,ZC20,200618,220951,6,395,65535,1)
Client: (864768011370522,DW30,200618,A,4113.41859S,17454.39335E,28.790,220957,191.54,-3.00,12,0)(864768011370522,DW30,200618,A,4113.49471S,17454.37024E,28.022,221007,192.55,-0.30,11,0)
Client: (864768011370522,DW30,200618,A,4113.56694S,17454.35106E,24.376,221017,192.19,-1.50,12,0)(864768011370522,DW30,200618,A,4113.63252S,17454.33110E,25.217,221027,192.77,2.60,11,0)
Client: (864768011370522,DW30,200618,A,4113.70313S,17454.31113E,27.133,221037,190.12,0.20,11,0)(864768011370522,DW30,200618,A,4113.77387S,17454.29373E,24.371,221047,190.40,1.60,10,0)

It posts multiple lines. Should I assume that I'd need to break up the brackets as the lines I'd send to Traccar?
ie:

Client: (864768011370522,DW30,200618,A,4113.70313S,17454.31113E,27.133,221037,190.12,0.20,11,0)(864768011370522,DW30,200618,A,4113.77387S,17454.29373E,24.371,221047,190.40,1.60,10,0)

Would become

864768011370522,DW30,200618,A,4113.70313S,17454.31113E,27.133,221037,190.12,0.20,11,0
864768011370522,DW30,200618,A,4113.77387S,17454.29373E,24.371,221047,190.40,1.60,10,0

?

Anton Tananaev6 years ago

You have to send original data as device sends it.

By the way, when you format the code with triple-back-ticks, it has to be on a separate line.

David Cole6 years ago

Hi

This is the tk103 protocol isn't it? Use by a kingneed t8124g (moved to this as 2g was being turned off in nz)

864768011370522,DW5B,530,24,263,171687,0,240318,043525
864768011370522,ZC20,240318,043525,6,396,65535,1
864768011370522,DW3B,240318,A,4113.04256S,17454.45046E,0.035,043604,000.0,-9.50,6,0
864768011370522,ZC20,240318,043602,6,393,65535,1
864768011370522,DW5B,530,24,263,171687,0,240318,044024
864768011370522,ZC20,240318,044024,6,396,65535,1
864768011370522,DW3B,240318,A,4113.03843S,17454.45283E,0.085,044213,000.0,-50.20,8,0
864768011370522,ZC20,240318,044213,6,396,65535,1

I see in here they only use a 12 digit imei:
https://www.traccar.org/forums/topic/kingneed-t8124/

Which particular command is being looked at the Dw3b?

Anton Tananaev6 years ago

It looks like TK103, but brackets are missing.