aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xscripts/match-road.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/match-road.sh b/scripts/match-road.sh
index 608fc56..1c8f28b 100755
--- a/scripts/match-road.sh
+++ b/scripts/match-road.sh
@@ -24,7 +24,9 @@ LIMIT=10
24# define the lowest confidence of accepted matched points 24# define the lowest confidence of accepted matched points
25THRESHOLD=0.3 25THRESHOLD=0.3
26 26
27if [[ -z $1 ]]; then echo "You need to give a gpx file!"; exit 1; fi
27ORIGIN_DATA=/tmp/$(basename $1).origin 28ORIGIN_DATA=/tmp/$(basename $1).origin
29RESPONSES=/tmp/$(basename $1).responses && true > $RESPONSES
28MATCHED=/tmp/$(basename $1).matched 30MATCHED=/tmp/$(basename $1).matched
29 31
30# extract data from the given gpx file, dump data with format [coordindate] [time_to_second], like: 32# extract data from the given gpx file, dump data with format [coordindate] [time_to_second], like:
@@ -130,9 +132,17 @@ while [ -s $ORIGIN_DATA ]; do
130 head -$LIMIT $ORIGIN_DATA | 132 head -$LIMIT $ORIGIN_DATA |
131 make_geojson | 133 make_geojson |
132 query_matched_points | 134 query_matched_points |
135 tee -a $RESPONSES |
136 tee /dev/tty |
133 validate_matched_points 137 validate_matched_points
134 138
135 # Remove processed raw data 139 # Remove processed raw data
140 echo $LIMIT of $(wc -l $ORIGIN_DATA) > /dev/tty
136 sed -i "1,$LIMIT d" $ORIGIN_DATA 141 sed -i "1,$LIMIT d" $ORIGIN_DATA
137done | 142done |
138make_geojson > test.geojson 143make_geojson > test.geojson
144
145RAW_RESPONSE=$(basename $1 | tr '.' '_')_response.geojson
146MATCHED_POINTS=$(basename $1 | tr '.' '_')_matched.geojson
147jq . $RESPONSES | jq -s '.[0].features=[.[]|.features[]] | .[0] | del(.code)' > $RAW_RESPONSE
148jq '.features=(.features|map(.geometry.coordinates=.properties.matchedPoints))' $RAW_RESPONSE > $MATCHED_POINTS