From f40d97cc733caac426558183708c051ea863dea8 Mon Sep 17 00:00:00 2001 From: Stan Soldatov <118521851+iwatkot@users.noreply.github.com> Date: Sun, 12 Jan 2025 13:32:06 +0100 Subject: [PATCH] Skipping incorrect polygons in custom OSM files * Skipping incorrect polygons. * Linter updates. --- maps4fs/generator/texture.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/maps4fs/generator/texture.py b/maps4fs/generator/texture.py index 91a9e05..310cde3 100644 --- a/maps4fs/generator/texture.py +++ b/maps4fs/generator/texture.py @@ -421,7 +421,7 @@ def layers_by_priority(self) -> list[Layer]: ), ) - # pylint: disable=no-member, R0912 + # pylint: disable=no-member, R0912, R0915 def draw(self) -> None: """Iterates over layers and fills them with polygons from OSM data.""" layers = self.layers_by_priority() @@ -461,6 +461,9 @@ def draw(self) -> None: for polygon in self.objects_generator( # type: ignore layer.tags, layer.width, layer.info_layer ): + if not len(polygon) > 2: + self.logger.debug("Skipping polygon with less than 3 points.") + continue if layer.info_layer: info_layer_data[layer.info_layer].append( self.np_to_polygon_points(polygon) # type: ignore