diff --git a/ground_station/resources/core/mapping.py b/ground_station/resources/core/mapping.py index 2b57143..648c035 100644 --- a/ground_station/resources/core/mapping.py +++ b/ground_station/resources/core/mapping.py @@ -1,8 +1,11 @@ ''' Mapping.py: Objected Orientated Google Maps for Python +Written by Chris Pham + Copyright OSURC, orginal code from GooMPy by Alec Singer and Simon D. Levy + This code is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the @@ -73,7 +76,7 @@ class GMapsStitcher(object): def _pixels_to_degrees(self, pixels, zoom): return pixels * 2 ** (21-zoom) - def _grab_tile(self, sleeptime): + def _grab_tile(self, sleeptime=0): # Make the url string for polling # GET request header gets appended to the string urlbase = 'https://maps.googleapis.com/maps/api/staticmap?' @@ -99,6 +102,13 @@ class GMapsStitcher(object): if not os.path.exists('Resources/Maps'): os.mkdir('Resources/Maps') tile_object.save(filename) + #Added to prevent timeouts on Google Servers + time.sleep(sleeptime) return tile_object - \ No newline at end of file + + def _pixels_to_lon(self, iterator, lon_pixels): + # Magic Lines, no idea + degrees = _pixels_to_degrees(((iterator) - self.num_tiles / 2) * _TILESIZE, self.zoom) + return math.degrees((lon_pixels + degrees - _EARTHPIX) / _pixrad) +