diff options
author | typebrook <typebrook@gmail.com> | 2019-12-04 10:23:04 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2019-12-04 10:23:04 +0800 |
commit | 8329008853b62fd3b1e334e377e98f5618aba0c3 (patch) | |
tree | 73c813370b43a5f0b1f989ae3facb8197503043d /scripts/match-road.sh | |
parent | 7100e89a4c327898ee6e8bcfe888da921ff459a8 (diff) |
update
Diffstat (limited to 'scripts/match-road.sh')
-rwxr-xr-x | scripts/match-road.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/match-road.sh b/scripts/match-road.sh index be8d78a..499f6e0 100755 --- a/scripts/match-road.sh +++ b/scripts/match-road.sh | |||
@@ -46,12 +46,12 @@ do | |||
46 | # Put matched points and indices into tmp file | 46 | # Put matched points and indices into tmp file |
47 | paste -d' ' \ | 47 | paste -d' ' \ |
48 | <(jq -c '.features[0].properties.matchedPoints[]' $RESPONSE) \ | 48 | <(jq -c '.features[0].properties.matchedPoints[]' $RESPONSE) \ |
49 | <(jq -c '.features[0].properties.indices[]' $RESPONSE | xargs -I{} echo {}+1 | bc | xargs -I{} sed -n {}p $ORIGIN_DATA | cut -d' ' -f1 | date -f - +%s) \ | 49 | <(jq -c '.features[0].properties.indices[]' $RESPONSE | xargs -I{} echo {}+1 | bc | xargs -I{} sed -n {}p $ORIGIN_DATA | cut -d' ' -f1) \ |
50 | > $MATCHED | 50 | > $MATCHED |
51 | 51 | ||
52 | # FIXME temporary solution for timestamp to unmatched points | 52 | # FIXME temporary solution for timestamp to unmatched points |
53 | DURATION=$(jq '.features[0].properties.duration' $RESPONSE) | 53 | DURATION=$(jq '.features[0].properties.duration' $RESPONSE) |
54 | INTERVAL=$(echo "scale=2;" $DURATION / $LIMIT | bc -l) | 54 | INTERVAL=$(echo "scale=2;" $DURATION / $LIMIT | tee >(cat >> log) | bc -l) |
55 | 55 | ||
56 | # For each coodinates from Map Matching API, add timestamp at the end and print it out to tty | 56 | # For each coodinates from Map Matching API, add timestamp at the end and print it out to tty |
57 | jq -c '.features[0].geometry.coordinates[]' $RESPONSE |\ | 57 | jq -c '.features[0].geometry.coordinates[]' $RESPONSE |\ |
@@ -61,7 +61,7 @@ do | |||
61 | TIMESTAMP=$(head -1 $MATCHED | cut -d' ' -f2) | 61 | TIMESTAMP=$(head -1 $MATCHED | cut -d' ' -f2) |
62 | sed -i 1d $MATCHED | 62 | sed -i 1d $MATCHED |
63 | else | 63 | else |
64 | echo $line $(echo $TIMESTAMP + $INTERVAL | bc -l) | 64 | echo $line "$TIMESTAMP.5" |
65 | fi | 65 | fi |
66 | done |\ | 66 | done |\ |
67 | tee /dev/tty && rm $MATCHED | 67 | tee /dev/tty && rm $MATCHED |