mirror of
https://github.com/OSURoboticsClub/Rover_2017_2018.git
synced 2025-11-08 18:21:15 +00:00
Added _pixels_to_lat
This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
'''
|
'''
|
||||||
Mapping.py: Objected Orientated Google Maps for Python
|
Mapping.py: Objected Orientated Google Maps for Python
|
||||||
|
ReWritten by Chris Pham
|
||||||
Written by Chris Pham
|
|
||||||
|
|
||||||
Copyright OSURC, orginal code from GooMPy by Alec Singer and Simon D. Levy
|
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
|
This code is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Lesser General Public License as
|
it under the terms of the GNU Lesser General Public License as
|
||||||
published by the Free Software Foundation, either version 3 of the
|
published by the Free Software Foundation, either version 3 of the
|
||||||
@@ -25,10 +23,10 @@ along with this code. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
# Python native imports
|
# Python native imports
|
||||||
import math
|
import math
|
||||||
import urllib2
|
import urllib2
|
||||||
import PIL.Image
|
|
||||||
from io import StringIO, BytesIO
|
from io import StringIO, BytesIO
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import PIL.Image
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# Constants
|
# Constants
|
||||||
@@ -113,3 +111,7 @@ class GMapsStitcher(object):
|
|||||||
degrees = self._pixels_to_degrees(((iterator) - self.num_tiles / 2) * _TILESIZE, self.zoom)
|
degrees = self._pixels_to_degrees(((iterator) - self.num_tiles / 2) * _TILESIZE, self.zoom)
|
||||||
return math.degrees((lon_pixels + degrees - _EARTHPIX) / _pixrad)
|
return math.degrees((lon_pixels + degrees - _EARTHPIX) / _pixrad)
|
||||||
|
|
||||||
|
def _pixels_to_lat(self, iterator, lat_pixels):
|
||||||
|
# Magic Lines
|
||||||
|
degree = self._pixels_to_degrees((iterator - self.num_tiles / 2) * _TILESIZE, self.zoom)
|
||||||
|
return math.degrees(math.pi / 2 - 2 * math.atan(math.exp(((lat_pixels + degree) - _EARTHPIX) / _pixrad)))
|
||||||
|
|||||||
Reference in New Issue
Block a user