Closed GoogleCodeExporter closed 9 years ago
Same error in Chrome. It seems to be happening when it can't detect one of the
attributes, and so crashes when it calls %f on NoneType.
Little rewrite to make it look nicer, and it works in chrome and on android
like this:
geo = win.navigator.geolocation
def navi(pos):
xyz = pos.coords
data = {
'lat':xyz.latitude,
'lon':xyz.longitude,
'acc':xyz.accuracy,
'timestamp': pos.timestamp,
'alt':xyz.altitude,
'alt_acc':xyz.altitudeAccuracy,
'heading':xyz.heading,
'speed':xyz.speed
}
ul = UL()
for key in data.keys():
try:
string = key + ': ' + str(float(data[key]))
except ValueError:
string = key + ': Could not detect'
ul <= LI(string)
doc <= H3("Your position")
doc <= ul
def nonavi(error):
log(error)
if geo:
geo.getCurrentPosition(navi, nonavi)
else:
alert('geolocation not supported')
Cheers
-kelly
Original comment by Kelly.R...@gmail.com
on 6 Jan 2013 at 9:43
committed Kelly's fix
Original comment by francois...@gmail.com
on 16 Jan 2013 at 7:08
Original issue reported on code.google.com by
francois...@gmail.com
on 31 Dec 2012 at 3:53