fix error if there are no areas with an altitude

This commit is contained in:
Laura Klünder 2018-01-05 20:08:59 +01:00
parent 7aeecb085f
commit 831619c42a

View file

@ -313,7 +313,8 @@ class AltitudeArea(LevelGeometryMixin, models.Model):
while repeat:
repeat = False
distances, predecessors = dijkstra(csgraph, directed=False, return_predecessors=True, unweighted=True)
relevant_distances = distances[np.array(areas_with_altitude)[:, None], np.array(areas_with_altitude)]
np_areas_with_altitude = np.array(areas_with_altitude, dtype=np.uint32)
relevant_distances = distances[np_areas_with_altitude[:, None], np_areas_with_altitude]
# noinspection PyTypeChecker
for from_i, to_i in np.argwhere(np.logical_and(relevant_distances < np.inf, relevant_distances > 1)):
from_area = areas[areas_with_altitude[from_i]]