[fix] Reverting last two changes, have to fix on the OSM side

This commit is contained in:
Al
2015-11-01 16:23:41 -05:00
parent 90773294b9
commit 48a305c8c4
2 changed files with 3 additions and 15 deletions

View File

@@ -104,7 +104,8 @@ class PolygonIndex(object):
'''
if not coords or len(coords) < 3:
return None
return Polygon(coords)
poly = Polygon(coords)
return cls.fix_polygon(poly)
def add_geojson_like_record(self, rec, include_only_properties=None):
if not rec or not rec.get('geometry') or 'type' not in rec['geometry']:

View File

@@ -23,7 +23,6 @@ import sys
import tempfile
from functools import partial
from shapely.geos import TopologicalError
this_dir = os.path.realpath(os.path.dirname(__file__))
sys.path.append(os.path.realpath(os.path.join(os.pardir, os.pardir)))
@@ -688,19 +687,7 @@ class OSMReverseGeocoder(RTreePolygonIndex):
if poly is None or not poly.bounds or len(poly.bounds) != 4:
continue
# Figure out which outer polygon contains each inner polygon
try:
interior = [p2 for p2 in inner if poly.contains(p2)]
except TopologicalError:
poly = cls.fix_polygon(poly)
fixed_inner = []
for p in inner:
p = cls.fix_polygon(p)
if p.type != 'MultiPolygon':
fixed_inner.append(p)
else:
fixed_inner.extend(p)
inner = fixed_inner
interior = [p2 for p2 in inner if poly.contains(p2)]
interior = [p2 for p2 in inner if poly.contains(p2)]
if interior:
# Polygon with holes constructor