[osm] For formatting places from the polygon index, use centroid if representative_point fails

This commit is contained in:
Al
2016-07-29 07:13:41 -04:00
parent f38bb151e2
commit ed0b867c13

View File

@@ -864,7 +864,10 @@ class OSMAddressFormatter(object):
print('did {} formatted places'.format(i))
for props, poly in iter(self.components.osm_admin_rtree):
point = poly.context.representative_point()
try:
point = poly.context.representative_point()
except ValueError:
point = poly.context.centroid
lat = point.y
lon = point.x
props['lat'] = lat