[osm] trying representative_point() on the unfixed polygons to capture some cases where the geometry still needs to be fixed before it's valid

This commit is contained in:
Al
2016-11-22 01:28:02 -05:00
parent bf1928d8c0
commit 480796f46f

View File

@@ -169,7 +169,9 @@ class PolygonIndex(object):
poly = Polygon(coords, holes)
try:
invalid = cls.fix_invalid_polygons and not poly.is_valid and not poly.contains(poly.centroid)
if test_point is None:
test_point = poly.representative_point()
invalid = cls.fix_invalid_polygons and not poly.is_valid and not poly.contains(test_point)
except Exception:
invalid = True