ignore empty altitude areas
This commit is contained in:
parent
cb57090f13
commit
7a02f58175
2 changed files with 5 additions and 5 deletions
|
@ -72,11 +72,7 @@ def good_representative_point(geometry):
|
|||
if isinstance(geometry, Point):
|
||||
return geometry
|
||||
c = geometry.centroid
|
||||
try:
|
||||
x1, y1, x2, y2 = geometry.bounds
|
||||
except ValueError:
|
||||
# jup, this can happen
|
||||
return c
|
||||
x1, y1, x2, y2 = geometry.bounds
|
||||
lines = (tuple(assert_multilinestring(LineString(((x1, c.y), (x2, c.y))).intersection(geometry))) +
|
||||
tuple(assert_multilinestring(LineString(((c.x, y1), (c.x, y2))).intersection(geometry))))
|
||||
return min(lines, key=lambda line: (line.distance(c), line.length),
|
||||
|
|
|
@ -119,7 +119,11 @@ class Router:
|
|||
if not space.geometry_prep.intersects(area.geometry):
|
||||
continue
|
||||
for subgeom in assert_multipolygon(accessible_geom.intersection(area.geometry)):
|
||||
if subgeom.is_empty:
|
||||
continue
|
||||
area_clear_geom = unary_union(tuple(get_rings(subgeom.difference(obstacles_geom))))
|
||||
if area_clear_geom.is_empty:
|
||||
continue
|
||||
area = RouterAltitudeArea(subgeom, area_clear_geom,
|
||||
area.altitude, area.altitude2, area.point1, area.point2)
|
||||
area_nodes = tuple(node for node in space_nodes if area.geometry_prep.intersects(node.point))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue