diff options
author | typebrook <typebrook@gmail.com> | 2019-12-05 12:04:57 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2019-12-05 12:04:57 +0800 |
commit | 10b67a44f4cb630b3dff628f0b11ebe0e043926b (patch) | |
tree | 9c2b8a1c98df7bbe83115a4d505a5a759f160a46 | |
parent | 6e4eeaa2becc5441fce867f6737c8074d74dd44a (diff) |
update
-rwxr-xr-x | scripts/match-road.sh | 9 |
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 |
45 | function make_geojson() { | 45 | function 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 | ||
52 | get_data $1 | tee /dev/tty > $ORIGIN_DATA | 51 | get_data $1 > $ORIGIN_DATA |
53 | 52 | ||
54 | # Consume raw data with serveral request | 53 | # Consume raw data with serveral request |
55 | while [ -s $ORIGIN_DATA ]; do | 54 | while [ -s $ORIGIN_DATA ]; do |