From 7100e89a4c327898ee6e8bcfe888da921ff459a8 Mon Sep 17 00:00:00 2001 From: typebrook Date: Wed, 4 Dec 2019 10:00:01 +0800 Subject: update --- scripts/match-road.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'scripts') 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 <(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) \ > $MATCHED + # FIXME temporary solution for timestamp to unmatched points + DURATION=$(jq '.features[0].properties.duration' $RESPONSE) + INTERVAL=$(echo "scale=2;" $DURATION / $LIMIT | bc -l) + # For each coodinates from Map Matching API, add timestamp at the end and print it out to tty jq -c '.features[0].geometry.coordinates[]' $RESPONSE |\ while read line do - TIMESTAMP=$(head -1 $MATCHED | cut -d' ' -f2) - (head -1 $MATCHED | grep -F $line && sed -i 1d $MATCHED) || echo $line $TIMESTAMP jojo + if head -1 $MATCHED | grep -F $line; then + TIMESTAMP=$(head -1 $MATCHED | cut -d' ' -f2) + sed -i 1d $MATCHED + else + echo $line $(echo $TIMESTAMP + $INTERVAL | bc -l) + fi done |\ tee /dev/tty && rm $MATCHED -- cgit v1.2.3-70-g09d2