Added _pixels_to_lat

This commit is contained in:
Chris Pham
2018-01-18 13:21:38 -08:00
parent a35691bf59
commit 3a960d44f7

View File

@@ -1,11 +1,9 @@
'''
Mapping.py: Objected Orientated Google Maps for Python
Written by Chris Pham
ReWritten 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
@@ -25,10 +23,10 @@ along with this code. If not, see <http://www.gnu.org/licenses/>.
# Python native imports
import math
import urllib2
import PIL.Image
from io import StringIO, BytesIO
import os
import time
import PIL.Image
#####################################
# Constants
@@ -113,3 +111,7 @@ class GMapsStitcher(object):
degrees = self._pixels_to_degrees(((iterator) - self.num_tiles / 2) * _TILESIZE, self.zoom)
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)))