~mil/mobroute

4007e76e0a0bbd8c50677ad92bc6fa3090c2bea0 — Miles Alan 2 months ago ea056e1
Fix route_tester.sh script for updates in CLI
1 files changed, 11 insertions(+), 7 deletions(-)

M scripts/route_tester.sh
M scripts/route_tester.sh => scripts/route_tester.sh +11 -7
@@ 21,11 21,15 @@ genreq() {
  TOLAT=$4
  TOLON=$5
  echo '{
    load: {filter: {mdbid: ['$FEEDID']}},
    from: {lat: '$FROMLAT', lon: '$FROMLON'},
    to: {lat: '$TOLAT', lon: '$TOLON'},
    max_walk_seconds: 99999999999999,
    max_transfer_seconds: 600
    "route_params": {
      "feed_ids": ['$FEEDID'],
      "from": ['$FROMLAT', '$FROMLON'],
      "to": ['$TOLAT', '$TOLON'],
      "max_walk_seconds": 99999999999999,
      "transfer_categories": ["f", "i"],
      "output_formats": ["legs", "diagnostics", "mapurl", "request"],
      "max_transfer_seconds": 600
    }
  }'
}



@@ 37,7 41,7 @@ route() {
  # TODO: fix this is broken since API update
  echo "$FEEDID" | grep '[0-9]+'
  BBOX="$(
    ./mobroute msstatus -f '{filter: {mdbid: ['"$FEEDID"']}}' | jq '.[0].bbox' | grep -oE '[0-9,.-]+' | tr -d "\n"
    ./mobroute mobsql -mp '{"mobsql_params": {"op": "status", "feed_ids": ['"$FEEDID"']}}' | jq '.[0].bbox' | grep -oE '[0-9,.-]+' | tr -d "\n"
  )"

  LATA="$(echo $BBOX | cut -d, -f1)"


@@ 52,7 56,7 @@ route() {
  TOLAT="$(rnd $LATA $LATB $INTERVAL)"
  TOLON="$(rnd $LONA $LONB $INTERVAL)"

  ./mobroute route -p "$(genreq $FEEDID $FROMLAT $FROMLON $TOLAT $TOLON)"
  ./mobroute route -rp "$(genreq $FEEDID $FROMLAT $FROMLON $TOLAT $TOLON)"
}

if [ "$#" -eq 1 ]; then