Skip to content

Commit

Permalink
Skipping incorrect polygons in custom OSM files
Browse files Browse the repository at this point in the history
* Skipping incorrect polygons.

* Linter updates.
  • Loading branch information
iwatkot authored Jan 12, 2025
1 parent 7274071 commit f40d97c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion maps4fs/generator/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f40d97c

Please sign in to comment.