@@ -364,7 +364,7 @@ def shorten(code,latitude,longitude):
364
364
latitude: A latitude in signed decimal degrees.
365
365
"""
366
366
def clipLatitude (latitude ):
367
- return min (90 ,max (- 90 ,latitude ))
367
+ return min (90 , max (- 90 , latitude ))
368
368
369
369
"""
370
370
Compute the latitude precision value for a given code length. Lengths <=
@@ -374,7 +374,7 @@ def clipLatitude(latitude):
374
374
"""
375
375
def computeLatitutePrecision (codeLength ):
376
376
if codeLength <= 10 :
377
- return pow (20 ,math .floor ((codeLength / - 2 ) + 2 ))
377
+ return pow (20 , math .floor ((codeLength / - 2 ) + 2 ))
378
378
return pow (20 , - 3 ) / pow (GRID_ROWS_ , codeLength - 10 )
379
379
380
380
"""
@@ -410,16 +410,16 @@ def encodePairs(latitude, longitude, codeLength):
410
410
digitCount = 0
411
411
while digitCount < codeLength :
412
412
# Provides the value of digits in this place in decimal degrees.
413
- placeValue = PAIR_RESOLUTIONS_ [math .floor (digitCount / 2 )]
413
+ placeValue = PAIR_RESOLUTIONS_ [int ( math .floor (digitCount / 2 ) )]
414
414
# Do the latitude - gets the digit for this place and subtracts that for
415
415
# the next digit.
416
- digitValue = math .floor (adjustedLatitude / placeValue )
416
+ digitValue = int ( math .floor (adjustedLatitude / placeValue ) )
417
417
adjustedLatitude -= digitValue * placeValue
418
418
code += CODE_ALPHABET_ [digitValue ]
419
419
digitCount += 1
420
420
# And do the longitude - gets the digit for this place and subtracts that
421
421
# for the next digit.
422
- digitValue = math .floor (adjustedLongitude / placeValue )
422
+ digitValue = int ( math .floor (adjustedLongitude / placeValue ) )
423
423
adjustedLongitude -= digitValue * placeValue
424
424
code += CODE_ALPHABET_ [digitValue ]
425
425
digitCount += 1
@@ -452,8 +452,8 @@ def encodeGrid(latitude, longitude, codeLength):
452
452
adjustedLongitude = (longitude + LONGITUDE_MAX_ ) % lngPlaceValue
453
453
for i in range (codeLength ):
454
454
# Work out the row and column.
455
- row = math .floor (adjustedLatitude / (latPlaceValue / GRID_ROWS_ ))
456
- col = math .floor (adjustedLongitude / (lngPlaceValue / GRID_COLUMNS_ ))
455
+ row = int ( math .floor (adjustedLatitude / (latPlaceValue / GRID_ROWS_ ) ))
456
+ col = int ( math .floor (adjustedLongitude / (lngPlaceValue / GRID_COLUMNS_ ) ))
457
457
latPlaceValue /= GRID_ROWS_
458
458
lngPlaceValue /= GRID_COLUMNS_
459
459
adjustedLatitude -= row * latPlaceValue
@@ -543,7 +543,7 @@ def decodeGrid(code):
543
543
code_length: The number of significant characters that were in the code.
544
544
This excludes the separator.
545
545
"""
546
- class CodeArea :
546
+ class CodeArea ( object ) :
547
547
def __init__ (self ,latitudeLo , longitudeLo , latitudeHi , longitudeHi , codeLength ):
548
548
self .latitudeLo = latitudeLo
549
549
self .longitudeLo = longitudeLo
0 commit comments