Using google map on mobile phone
1 2 from urllib import urlretrieve 3 turl = 'http://mt.google.com/mt?v=w2.4&x=%s&y=%s&zoom=%s' 4 tfile = '%s-%s-%s.gif' 5 z = 12 6 for x in range(5,10): 7 for y in range(10,14): 8 urlretrieve(turl % (x,y,z), tfile % (z,y,x))
Then put the images in the phone. Then use the following code
to browse around the images (and zoom in/out)
1 2 from appuifw import * 3 from key_codes import * 4 from graphics import Image 5 import e32 6 7 app.screen = 'full' 8 app.body = c= Canvas() 9 10 x, y, z = 10*256, 24*256, 11 11 dirname = u'C:\\system\\data\\gmap\\' # where I save the tile images 12 13 def draw(): 14 gx, ox = divmod(x, 256) 15 gy, oy = divmod(y, 256) 16 f = dirname + '%s-%s-%s.gif' % (z,gy,gx) 17 c.blit(Image.open(f), target=(-ox,-oy)) 18 19 if ox > 80: 20 f = dirname + '%s-%s-%s.gif' % (z,gy,gx+1) 21 c.blit(Image.open(f), target=(256-ox,-oy)) 22 if oy > 48: 23 f = dirname + '%s-%s-%s.gif' % (z,gy+1,gx) 24 c.blit(Image.open(f), target=(-ox,256-oy)) 25 if ox > 80 and oy > 48: 26 f = dirname + '%s-%s-%s.gif' % (z,gy+1,gx+1) 27 c.blit(Image.open(f), target=(256-ox,256-oy)) 28 29 def move(dx,dy): 30 global x, y 31 x += dx * 50 32 y += dy * 50 33 draw() 34 35 def zoomin(): 36 global x,y,z 37 x = x*2 + 88 38 y = y*2 + 104 39 z = z-1 40 draw() 41 42 def zoomout(): 43 global x,y,z 44 x = x/2 - 44 45 y = y/2 - 52 46 z = z+1 47 draw() 48 49 c.bind(EKeyRightArrow,lambda:move(1, 0)) 50 c.bind(EKeyLeftArrow,lambda:move(-1, 0)) 51 c.bind(EKeyUpArrow,lambda:move(0, -1)) 52 c.bind(EKeyDownArrow,lambda:move(0, 1)) 53 c.bind(EKeySelect, zoomin) 54 c.bind(EKeyStar, zoomout) 55 56 running = 1 57 def quit(): 58 global running 59 running = 0 60 app.exit_key_handler= quit 61 62 draw() 63 while running: 64 e32.ao_sleep(0.1)
I put a bit more explanation in Nokia's forum here. (Newer version is available)
http://discussion.forum.nokia.com/forum/showthread.php?s=&postid=153609
Also see the screenshot here
http://flickr.com/photos/korakot/30189624/