Advertisement
l0rdjcd

Termux-Function - Show Location

Jul 21st, 2020
1,340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. geo(){
  2.     #Use: geo [option]
  3.     #   -g for open in Googlemaps
  4.     #   -w for open in Wigle.com
  5.     la=$(termux-location | sed -n 2p | sed 's/.*tude": //' | tr -d ',')
  6.     lo=$(termux-location | sed -n 3p | sed 's/.*tude": //' | tr -d ',')
  7.  
  8.     if [[ "$1" = "-g" ]]; then
  9.             termux-open-url http://www.google.com/maps/place/$la,$lo/@$la,$lo,16z ; fi
  10.     if [[ "$1" = "-w" ]]; then
  11.             termux-open-url https://wigle.net/map?maplat=$la&maplon=$lo&mapzoom=19&mapstyle=standard&coloring=qos ; fi
  12.  
  13.     w3m -dump "http://nominatim.openstreetmap.org/reverse?format=json&lat=$la&lon=$lo&zoom=20&addressdetails=1" | tr ',' '\n' | sed -n '16,25p' | tr -d '"}' | sed 's/..*://' | sed '10d' | sed 4d > .tmp
  14.     echo "Aktueller Standort"
  15.     echo $(sed -n 2p .tmp) $(sed -n 1p .tmp)
  16.     echo in $(sed -n 7p .tmp) $(sed -n 4p .tmp)
  17.     echo $(sed -n 5p .tmp)
  18.     echo Bundesland $(sed -n 6p .tmp)
  19.     echo $(sed -n 8p .tmp); rm .tmp
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement