[osm] For formatting places from the polygon index, use centroid if representative_point fails
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user