aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-12-05 12:04:57 +0800
committertypebrook <typebrook@gmail.com>2019-12-05 12:04:57 +0800
commit10b67a44f4cb630b3dff628f0b11ebe0e043926b (patch)
tree9c2b8a1c98df7bbe83115a4d505a5a759f160a46 /scripts
parent6e4eeaa2becc5441fce867f6737c8074d74dd44a (diff)
update
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/match-road.sh9
1 files changed, 4 insertions, 5 deletions
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() {
43 43
44# Read date Make GeoJSON object for Map Matching API 44# Read date Make GeoJSON object for Map Matching API
45function make_geojson() { 45function make_geojson() {
46 jq --slurp '{type: "Feature", properties: {coordTimes: .[1]}, geometry: {type: "LineString", coordinates: .[0]}}' \ 46 #jq -nR '{type: "Feature", properties: {coordTimes: .[1]}, geometry: {type: "LineString", coordinates: .[0]}}'
47 <(cut -d' ' -f1 | jq -n '[inputs]') \ 47 awk '{printf("[%s,\"%s\"]\n", $1, $2)}' |\
48 <(cut -d' ' -f2 | jq -nR '[inputs]') |\ 48 jq '[inputs] | {type: "Feature", properties: {coordTimes: (map(.[1]))}, geometry: {type: "LineString", coordinates: map(.[0])}}'
49 tee tmp_$(head -1 $ORIGIN_DATA | cut -d ' ' -f2 | date -f - +%s).geojson
50} 49}
51 50
52get_data $1 | tee /dev/tty > $ORIGIN_DATA 51get_data $1 > $ORIGIN_DATA
53 52
54# Consume raw data with serveral request 53# Consume raw data with serveral request
55while [ -s $ORIGIN_DATA ]; do 54while [ -s $ORIGIN_DATA ]; do