Make lines_to_leaflet tolerant of single lines.

This commit is contained in:
Dan Albert 2022-02-13 14:22:57 -08:00
parent d488bcffbd
commit 1adafac35f

View File

@ -34,6 +34,10 @@ class ShapelyUtil:
@classmethod @classmethod
def lines_to_leaflet( def lines_to_leaflet(
cls, lines: MultiLineString, theater: ConflictTheater cls, line_string: MultiLineString | LineString, theater: ConflictTheater
) -> list[list[LeafletLatLon]]: ) -> list[list[LeafletLatLon]]:
return [cls.line_to_leaflet(line, theater) for line in lines.geoms] if isinstance(line_string, MultiLineString):
lines = line_string.geoms
else:
lines = [line_string]
return [cls.line_to_leaflet(line, theater) for line in lines]