#!/bin/rc rfork e gmapkey = `{cat /lib/gmapkey} here = `{cat /lib/sky/here} lat = $here(1) lng = -$here(2) if(~ $#gmapkey 0){ echo goto http://code.google.com/apis/maps/signup.html and get a google maps key (free) exit 'no key' } flagfmt = 'z zoom,r,s,t,h' args = query if(! ifs = () eval `{aux/getflags $*}){ aux/usage exit usage } if(~ $#flagz 0) flagz = 16 t = roadmap ~ $#flagh 1 && t = hybrid ~ $#flagt 1 && t = terrain ~ $#flags 1 && t = satellite if(! ~ $#* 0){ query="" for (p) query=$query+$p there=`{ hget 'http://maps.google.com/maps/geo?q='$"query^'&output=csv&oe=utf8&sensor=false&key='$gmapkey | sed 's/,/ /g; 1q' } if(! ~ $there(1) 200){ echo $* - not found exit 'not found' } lng=$there(4) lat=$there(3) } if(~ $t terrain && ~ $flagz 1[6-9]) flagz = 15 hget 'http://maps.google.com/staticmap?center='$lat^,^$lng^'&size=600x600&zoom='$flagz'&sensor=false&format=png&key='$gmapkey'&maptype='$t | png