diff options
| -rwxr-xr-x | scripts/match.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/match.sh b/scripts/match.sh index 3c1216a..876b78d 100755 --- a/scripts/match.sh +++ b/scripts/match.sh | |||
| @@ -1,10 +1,11 @@ | |||
| 1 | #! /bin/bash | 1 | #! /bin/bash |
| 2 | 2 | ||
| 3 | #set -x | 3 | #set -x |
| 4 | set -e | ||
| 4 | 5 | ||
| 5 | ACCESS_TOKEN=$(cat ~/settings/tokens/mapbox) | 6 | ACCESS_TOKEN=$(cat ~/settings/tokens/mapbox) |
| 6 | #export MAPBOX_ACCESS_TOKEN=$ACCESS_TOKEN | 7 | #export MAPBOX_ACCESS_TOKEN=$ACCESS_TOKEN |
| 7 | LIMIT=100 | 8 | LIMIT=10 |
| 8 | TRK_NAME=$(sed -nr 's/.*<name>(.*)<\/name>.*/\1/p; /<name>/q' $1) | 9 | TRK_NAME=$(sed -nr 's/.*<name>(.*)<\/name>.*/\1/p; /<name>/q' $1) |
| 9 | 10 | ||
| 10 | # Need to add pre-process for duplicated gpx trkpts | 11 | # Need to add pre-process for duplicated gpx trkpts |
| @@ -21,7 +22,6 @@ do | |||
| 21 | jq --slurp '{type: "Feature", properties: {coordTimes: .[1]}, geometry: {type: "LineString", coordinates: .[0]}}' \ | 22 | jq --slurp '{type: "Feature", properties: {coordTimes: .[1]}, geometry: {type: "LineString", coordinates: .[0]}}' \ |
| 22 | <(head -$LIMIT origin | cut -d' ' -f2 | jq -n '[inputs]') \ | 23 | <(head -$LIMIT origin | cut -d' ' -f2 | jq -n '[inputs]') \ |
| 23 | <(head -$LIMIT origin | cut -d' ' -f1 | jq -nR '[inputs]') |\ | 24 | <(head -$LIMIT origin | cut -d' ' -f1 | jq -nR '[inputs]') |\ |
| 24 | tee input.geojson |\ | ||
| 25 | curl -X POST -s --header "Content-Type:application/json" --data @- https://api.mapbox.com/matching/v4/mapbox.driving.json?access_token=$ACCESS_TOKEN > response | 25 | curl -X POST -s --header "Content-Type:application/json" --data @- https://api.mapbox.com/matching/v4/mapbox.driving.json?access_token=$ACCESS_TOKEN > response |
| 26 | 26 | ||
| 27 | jq -c '.features[0].geometry.coordinates[]' response |\ | 27 | jq -c '.features[0].geometry.coordinates[]' response |\ |