[fix] non-integer admin levels

This commit is contained in:
Al
2015-11-22 18:33:27 -05:00
parent 7ee8045a0f
commit 04183c672e

View File

@@ -721,7 +721,11 @@ class OSMReverseGeocoder(RTreePolygonIndex):
def sort_level(self, i):
props, p = self.polygons[i]
return int(props.get(self.ADMIN_LEVEL, 0))
admin_level = props.get(self.ADMIN_LEVEL, 0)
try:
return int(admin_level)
except ValueError:
return 0
def get_candidate_polygons(self, lat, lon):
candidates = super(OSMReverseGeocoder, self).get_candidate_polygons(lat, lon)