clarification

This commit is contained in:
Dziad Borowy 2023-01-18 11:06:35 +00:00
parent 55a23610ce
commit 1300897484

View File

@ -16,7 +16,7 @@ docker run --rm --entrypoint cat debian-traccar-nginx:latest /opt/traccar/conf/t
```
## Configuration parameters for MySQL
Replace [DATABASE], [USER], [PASSWORD] with appropriate values from `docker-compose.yml` replace `[HOST]` with IPv4 address from `db_name` section in `docker network inspect`:
In `traccar.xml` file update the following section:
```xml
<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
@ -24,6 +24,9 @@ Replace [DATABASE], [USER], [PASSWORD] with appropriate values from `docker-comp
<entry key='database.user'>[USER]</entry>
<entry key='database.password'>[PASSWORD]</entry>
```
- replace [DATABASE], [USER], [PASSWORD] with appropriate values from `docker-compose.yml`
- replace `[HOST]` with IPv4 address from `db_name` section in `docker network inspect`
## docker-compose.yml
@ -132,27 +135,36 @@ pip install -r requirements.txt
python location_history_json_converter.py Records.json output.csv -f csv
```
csv output will generate Comma-separated text file with a timestamp field and a location field
we'll add a deviceid , protocol and valid fileds to it
The csv file generated by the script above will contains 3 columns:
- `time`
- `latitute`
- `longitude`
We'll add more columns:
- `deviceid`
- `protocol`
- `valid`
using the following command:
```sh
sed 's/^/osmand,1,/; s/$/,1/' export.csv > curated.csv
```
delete the "1" from the first line an replace osmand with protocol in the first line, so now the file looks like
The csv file should now contain 6 columns:
- `@osmand`
- `@deviceid`
- `@time`
- `@latitude`
- `@longitude`
- `@valid`
These represent `tc_positions` table fields in traccar postgres db, so now the file should look like this:
```csv
protocol,Time,Latitude,Longitude
osmand,1,2012-08-25 21:26:20,37.95954620,23.72793730,1
protocol, 1, Time, Latitude, Longitude, 1
osmand, 1, 2012-08-25 21:26:20, 37.95954620, 23.72793730, 1
```
5 columns
osmand
1
time
lat
lon
We are going to parse those values to as sql `LOAD DATA LOCAL INFILE` statement to the appropriate tc_position table fields
- copy the csv to the container