import from google location history

ippo2 years ago

I have deployed traccar with docker-compose with mariadb

I exported my google location history as json

Striped down the Records.json to a CSV only containing time,lat,long with
https://github.com/Scarygami/location-history-json-converter
and added 2 more columns for "valid" and "deviceid" with

sed 's/^/1,/; s/$/,1/' export.csv > export2.csv

And removed the "1" from the first line
Sample

deviceid,Time,Latitude,Longitude,valid
1,2012-08-25 21:26:20,37.95954620,23.72793730,1
1,2012-08-30 20:20:20,37.95858000,23.72795600,1
1,2012-08-30 20:22:01,37.95945480,23.72792360,1
1,2012-08-30 20:23:01,37.95858000,23.72795600,1
1,2012-08-30 20:28:28,37.95955330,23.72785750,1

Moved the file to the container

docker cp export2.csv traccar-db:/

and import it to my db

LOAD DATA LOCAL INFILE 'export2.csv' INTO TABLE tc_positions FIELDS TERMINATED BY ',' (@deviceid,@Time,@Latitude,@Longitude,@valid) set deviceid=@deviceid,devicetime=@Time,latitude=@Latitude,longitude=@Longitude,valid=@valid;

The database looks OK with the appropriate fields filled properly but the webui and the manager app is not showing anything for the added dates

The database was already populated and the imported data are from older dates

So may that be the reson?

Do I need to place the imported date to table rows with lower id's?

Thanks

ippo2 years ago

As mentioned in the github issue it was the fixtime table field that had to be filled
https://github.com/traccar/traccar/issues/5002
And sorry for duplicating the issue Anton
Apologies and thanks for the great software