Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ansate committed Jul 22, 2011
1 parent 985bad7 commit 338d82f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions blockr.py
Expand Up @@ -224,8 +224,8 @@ def score_block(polygon):
#nbhds[place_id] = hole
#changed = True
continue
elif hole.intersects(polygons[place_id]['shape']):
polygons[place_id]['shape'] = polygons[place_id]['shape'].union(hole)
elif hole.intersects(polygons[place_id]):
polygons[place_id] = polygons[place_id].union(hole)
changed = True
if changed:
break
Expand All @@ -244,7 +244,11 @@ def score_block(polygon):
if type(polygon) is Polygon:
polygon = Polygon(polygon.exterior.coords)
else:
polygon = MultiPolygon([Polygon(p.exterior.coords)for p in polygon.geoms])
bits = []
for p in polygon.geoms:
if type(p) is Polygon:
bits.append(Polygon(p.exterior.coords))
polygon = MultiPolygon(bits)
polygons[place_id] = polygon.buffer(0)

print >>sys.stderr, "Writing output."
Expand Down

0 comments on commit 338d82f

Please sign in to comment.