From 2ae5b5af23290c3994d090b5b832ad1775de69b4 Mon Sep 17 00:00:00 2001 From: javiplx Date: Sun, 8 May 2011 12:25:03 +0000 Subject: [PATCH] BUGFIX : calculate reference pixel properly git-svn-id: file:///svnroot/wifihood/branches/mapview-redesign@147 c51dfc6a-5949-4919-9c8e-f207a149c383 --- view.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/view.py b/view.py index 4d2da74..0585a2a 100755 --- a/view.py +++ b/view.py @@ -57,14 +57,16 @@ class tile_loader : def get_reference ( self , conf ) : tilex = self.lon2tilex( conf.lon , conf.zoom ) tiley = self.lat2tiley( conf.lat , conf.zoom ) - return ( tilex[1] , tiley[1] ) , ( tilex[0] , tiley[0] ) + tile = tilex[1] , tiley[1] + pix = tilex[0] , tiley[0] + return map( int , tile ) , map( lambda x : int( self.tilesize * x ) , pix ) def lon2tilex ( self , lon , zoom ) : - return map( int , math.modf( ( lon + 180 ) / 360 * 2 ** zoom ) ) + return math.modf( ( lon + 180 ) / 360 * 2 ** zoom ) def lat2tiley ( self , lat , zoom ) : lat = lat * math.pi / 180 - return map( int , math.modf( ( 1 - math.log( math.tan( lat ) + 1 / math.cos( lat ) ) / math.pi ) / 2 * 2 ** zoom ) ) + return math.modf( ( 1 - math.log( math.tan( lat ) + 1 / math.cos( lat ) ) / math.pi ) / 2 * 2 ** zoom ) def get_tile ( self , tile ) : file = self.tilepath( self.reftile[0] + tile[0] , self.reftile[1] + tile[1] ) -- 1.7.9.5