@@ -275,11 +275,8 @@ def decode(code):
275
275
to find the nearest matching full code.
276
276
Returns:
277
277
The nearest full Open Location Code to the reference location that matches
278
- the short code. Note that the returned code may not have the same
279
- computed characters as the reference location. This is because it returns
280
- the nearest match, not necessarily the match within the same cell. If the
281
- passed code was not a valid short code, but was a valid full code, it is
282
- returned unchanged.
278
+ the short code. If the passed code was not a valid short code, but was a
279
+ valid full code, it is returned unchanged.
283
280
"""
284
281
def recoverNearest (shortcode , referenceLatitude , referenceLongitude ):
285
282
if not isShort (shortcode ):
@@ -295,11 +292,8 @@ def recoverNearest(shortcode, referenceLatitude, referenceLongitude):
295
292
resolution = pow (20 , 2 - (paddingLength / 2 ))
296
293
# Distance from the center to an edge (in degrees).
297
294
areaToEdge = resolution / 2.0
298
- # Now round down the reference latitude and longitude to the resolution.
299
- roundedLatitude = math .floor (referenceLatitude / resolution ) * resolution
300
- roundedLongitude = math .floor (referenceLongitude / resolution ) * resolution
301
295
# Use the reference location to pad the supplied short code and decode it.
302
- codeArea = decode (encode (roundedLatitude , roundedLongitude )[0 :paddingLength ] + shortcode )
296
+ codeArea = decode (encode (referenceLatitude , referenceLongitude )[0 :paddingLength ] + shortcode )
303
297
# How many degrees latitude is the code from the reference? If it is more
304
298
# than half the resolution, we need to move it east or west.
305
299
degreesDifference = codeArea .latitudeCenter - referenceLatitude
0 commit comments