diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/match-road.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/match-road.sh b/scripts/match-road.sh index 8281709..be8d78a 100755 --- a/scripts/match-road.sh +++ b/scripts/match-road.sh | |||
@@ -49,12 +49,20 @@ do | |||
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 | date -f - +%s) \ |
50 | > $MATCHED | 50 | > $MATCHED |
51 | 51 | ||
52 | # FIXME temporary solution for timestamp to unmatched points | ||
53 | DURATION=$(jq '.features[0].properties.duration' $RESPONSE) | ||
54 | INTERVAL=$(echo "scale=2;" $DURATION / $LIMIT | bc -l) | ||
55 | |||
52 | # 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 |
53 | jq -c '.features[0].geometry.coordinates[]' $RESPONSE |\ | 57 | jq -c '.features[0].geometry.coordinates[]' $RESPONSE |\ |
54 | while read line | 58 | while read line |
55 | do | 59 | do |
56 | TIMESTAMP=$(head -1 $MATCHED | cut -d' ' -f2) | 60 | if head -1 $MATCHED | grep -F $line; then |
57 | (head -1 $MATCHED | grep -F $line && sed -i 1d $MATCHED) || echo $line $TIMESTAMP jojo | 61 | TIMESTAMP=$(head -1 $MATCHED | cut -d' ' -f2) |
62 | sed -i 1d $MATCHED | ||
63 | else | ||
64 | echo $line $(echo $TIMESTAMP + $INTERVAL | bc -l) | ||
65 | fi | ||
58 | done |\ | 66 | done |\ |
59 | tee /dev/tty && rm $MATCHED | 67 | tee /dev/tty && rm $MATCHED |
60 | 68 | ||