From 10b67a44f4cb630b3dff628f0b11ebe0e043926b Mon Sep 17 00:00:00 2001 From: typebrook Date: Thu, 5 Dec 2019 12:04:57 +0800 Subject: update --- scripts/match-road.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/match-road.sh b/scripts/match-road.sh index 853980a..1846102 100755 --- a/scripts/match-road.sh +++ b/scripts/match-road.sh @@ -43,13 +43,12 @@ function get_data() { # Read date Make GeoJSON object for Map Matching API function make_geojson() { - jq --slurp '{type: "Feature", properties: {coordTimes: .[1]}, geometry: {type: "LineString", coordinates: .[0]}}' \ - <(cut -d' ' -f1 | jq -n '[inputs]') \ - <(cut -d' ' -f2 | jq -nR '[inputs]') |\ - tee tmp_$(head -1 $ORIGIN_DATA | cut -d ' ' -f2 | date -f - +%s).geojson + #jq -nR '{type: "Feature", properties: {coordTimes: .[1]}, geometry: {type: "LineString", coordinates: .[0]}}' + awk '{printf("[%s,\"%s\"]\n", $1, $2)}' |\ + jq '[inputs] | {type: "Feature", properties: {coordTimes: (map(.[1]))}, geometry: {type: "LineString", coordinates: map(.[0])}}' } -get_data $1 | tee /dev/tty > $ORIGIN_DATA +get_data $1 > $ORIGIN_DATA # Consume raw data with serveral request while [ -s $ORIGIN_DATA ]; do -- cgit v1.2.3-70-g09d2