[fix] allowing latitude 90 for validation purposes (North Pole)

This commit is contained in:
Al
2016-09-23 01:28:13 -04:00
parent 996a38d017
commit d66ea835b1
2 changed files with 4 additions and 3 deletions

View File

@@ -57,8 +57,6 @@ def degrees_to_decimal(degrees, minutes, seconds):
return degrees + (minutes / 60.0) + (seconds / 3600.0)
def is_valid_latitude(latitude):
'''Latitude must be real number between -90.0 and 90.0'''
try:
@@ -66,7 +64,7 @@ def is_valid_latitude(latitude):
except (ValueError, TypeError):
return False
if latitude >= 90.0 or latitude < -90.0 or math.isinf(latitude) or math.isnan(latitude):
if latitude > 90.0 or latitude < -90.0 or math.isinf(latitude) or math.isnan(latitude):
return False
return True

View File

@@ -203,6 +203,9 @@ class OSMPolygonReader(object):
if lat is None or lon is None:
continue
if isclose(lat, 90.0):
lat = 89.999
if isclose(lon, 180.0):
lon = 179.999