aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-12-04 10:00:01 +0800
committertypebrook <typebrook@gmail.com>2019-12-04 10:00:01 +0800
commit7100e89a4c327898ee6e8bcfe888da921ff459a8 (patch)
tree51d28d9bb9ce4a5c620cf1da76db8f4b08c6c7a1 /scripts
parent4947dd920b87a585b7be84e6169f5d4bf685aba8 (diff)
update
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/match-road.sh12
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