mirror of
https://github.com/OSURoboticsClub/Rover_2017_2018.git
synced 2025-11-08 18:21:15 +00:00
Added pixel_to_degrees helper
This commit is contained in:
@@ -47,9 +47,9 @@ _pixrad = _EARTHPIX / math.pi
|
|||||||
|
|
||||||
|
|
||||||
class GMapsStitcher(object):
|
class GMapsStitcher(object):
|
||||||
def __init__(self, width, height, latitude,
|
def __init__(self, width, height,
|
||||||
longitude, zoom, maptype, radius_meters=None,
|
latitude, longitude, zoom,
|
||||||
num_tiles=4):
|
maptype, radius_meters=None, num_tiles=4):
|
||||||
self.latitude = latitude
|
self.latitude = latitude
|
||||||
self.longitude = longitude
|
self.longitude = longitude
|
||||||
self.width = width
|
self.width = width
|
||||||
@@ -58,4 +58,16 @@ class GMapsStitcher(object):
|
|||||||
self.maptype = maptype
|
self.maptype = maptype
|
||||||
self.radius_meters = radius_meters
|
self.radius_meters = radius_meters
|
||||||
|
|
||||||
|
def _new_image(self):
|
||||||
|
return PIL.Image.new('RGB', (self.width, self.height))
|
||||||
|
|
||||||
|
def _fast_round(self, value, precision):
|
||||||
|
return int(value * 10 ** precision) / 10. ** precision
|
||||||
|
|
||||||
|
def _pixels_to_degrees(self, pixels, zoom):
|
||||||
|
return pixels * 2 ** (21-zoom)
|
||||||
|
|
||||||
|
def _grab_tile(self, sleeptime):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user