Last active
September 10, 2021 22:07
-
-
Save tyjak/e41f26f331bb75e9fb532135d984ca77 to your computer and use it in GitHub Desktop.
clip/i3/route
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Popup i3 window to display a route on openstreetmap | |
# dependency: curl, jq, webapp | |
# GistID: e41f26f331bb75e9fb532135d984ca77 | |
FROM=$1 | |
DEST=$2 | |
# set HOME_ADDR as glabal env var for your address | |
[ -z "$DEST" ] && [ ! -z "$HOME_ADDR" ] && FROM=$HOME_ADDR && DEST=$1 | |
URI="https://www.openstreetmap.org/directions?engine=fossgis_osrm_car&route=$(curl -G --data-urlencode "q=$FROM" --data "format=json" https://nominatim.openstreetmap.org/search | jq -r '.[0].lat + "%2C" + .[0].lon')%3B$( curl -G --data-urlencode "q=$DEST" --data "format=json" https://nominatim.openstreetmap.org/search | jq -r '.[0].lat + "%2C" + .[0].lon')" | |
webapp \"$URI\" route 1000 800 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment