From 00b136155183ae522ca458e540a8cf29bf525e74 Mon Sep 17 00:00:00 2001 From: typebrook Date: Thu, 27 Feb 2020 16:32:37 +0800 Subject: update --- scripts/match-road.sh | 148 -------------------------------------------------- 1 file changed, 148 deletions(-) delete mode 100755 scripts/match-road.sh (limited to 'scripts/match-road.sh') diff --git a/scripts/match-road.sh b/scripts/match-road.sh deleted file mode 100755 index d9beaae..0000000 --- a/scripts/match-road.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/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 - -# put yout Mapbox token here -ACCESS_TOKEN=$(cat ~/settings/tokens/mapbox) -# number of coordinates for each Mapbox Map Matching API request, Maximum value is 100 -LIMIT=100 -# define the lowest confidence of accepted matched points -THRESHOLD=0.0001 - -if [[ -z $1 ]]; then echo "You need to give a gpx file!"; exit 1; fi -ORIGIN_DATA=/tmp/$(basename $1).origin -RESPONSES=/tmp/$(basename $1).responses && true > $RESPONSES -MATCHED=/tmp/$(basename $1).matched - -# extract data from the given gpx file -# only keep first point and remove the rest which in the same "second" -# input: [gpx format] -# output: [121.0179739,14.5515336] 1984-01-01T08:00:46 -get_data() { - sed -nr '// {H; /<\/trkpt>/ {x; s/\n/ /g; p; s/.*//; x}}' $1 | - sed -nr 'h; s/.*lon="([^"]+).*/\1/; H; g - s/.*lat="([^"]+).*/\1/; H; g - # If trkpt has no time, leave it blank - /time/ { - s/.*