From 480796f46fe36edddb07340b6dc93fcff25ec58c Mon Sep 17 00:00:00 2001 From: Al Date: Tue, 22 Nov 2016 01:28:02 -0500 Subject: [PATCH] [osm] trying representative_point() on the unfixed polygons to capture some cases where the geometry still needs to be fixed before it's valid --- scripts/geodata/polygons/index.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/geodata/polygons/index.py b/scripts/geodata/polygons/index.py index c75d3924..59010800 100644 --- a/scripts/geodata/polygons/index.py +++ b/scripts/geodata/polygons/index.py @@ -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