diff options
Diffstat (limited to 'scripts/match-road.sh')
-rwxr-xr-x | scripts/match-road.sh | 10 |
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 |
25 | THRESHOLD=0.3 | 25 | THRESHOLD=0.3 |
26 | 26 | ||
27 | if [[ -z $1 ]]; then echo "You need to give a gpx file!"; exit 1; fi | ||
27 | ORIGIN_DATA=/tmp/$(basename $1).origin | 28 | ORIGIN_DATA=/tmp/$(basename $1).origin |
29 | RESPONSES=/tmp/$(basename $1).responses && true > $RESPONSES | ||
28 | MATCHED=/tmp/$(basename $1).matched | 30 | MATCHED=/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 |
137 | done | | 142 | done | |
138 | make_geojson > test.geojson | 143 | make_geojson > test.geojson |
144 | |||
145 | RAW_RESPONSE=$(basename $1 | tr '.' '_')_response.geojson | ||
146 | MATCHED_POINTS=$(basename $1 | tr '.' '_')_matched.geojson | ||
147 | jq . $RESPONSES | jq -s '.[0].features=[.[]|.features[]] | .[0] | del(.code)' > $RAW_RESPONSE | ||
148 | jq '.features=(.features|map(.geometry.coordinates=.properties.matchedPoints))' $RAW_RESPONSE > $MATCHED_POINTS | ||