From 4947dd920b87a585b7be84e6169f5d4bf685aba8 Mon Sep 17 00:00:00 2001 From: typebrook Date: Wed, 4 Dec 2019 09:16:44 +0800 Subject: update --- scripts/match-road.sh | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/match.sh | 79 --------------------------------------------------- 2 files changed, 79 insertions(+), 79 deletions(-) create mode 100755 scripts/match-road.sh delete mode 100755 scripts/match.sh (limited to 'scripts') diff --git a/scripts/match-road.sh b/scripts/match-road.sh new file mode 100755 index 0000000..8281709 --- /dev/null +++ b/scripts/match-road.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash +# +# Author: Pham +# +# This script accepts a single GPX file as parameter and +# output the processed GPX body to STDOUT, using Mapbox Map Matching API v4. +# read doc at: https://docs.mapbox.com/api/legacy/map-matching-v4/ +# +# Example: +# +# match-road.sh raw.gpx > new.gpx +# +# Hint: +# +# Remember to put Mapbox Access Token at the top! + +#set -x +set -e + +ACCESS_TOKEN=$(cat ~/settings/tokens/mapbox) # put yout Mapbox token here +LIMIT=10 # number of coordinates for each Mapbox Map Matching API request, Maximum value is 100 + +ORIGIN_DATA=/tmp/origin +RESPONSE=/tmp/response +MATCHED=/tmp/matched + +# store data of time and location into tmp file with 2 columns, format is like: +# 1970-01-01T08:00:46 [121.0179739,14.5515336] +paste -d' ' \ + <(sed -nr '//,/<\/trk>/ { s/.*