Commit 046f2ac2 authored by Rick Gruber-Riemer's avatar Rick Gruber-Riemer

Fix for issue #112: too few points in polygon in aptdat

parent 44bbc799
...@@ -14,7 +14,6 @@ Ludomotico contributed a cleaner version of read_from_file(). ...@@ -14,7 +14,6 @@ Ludomotico contributed a cleaner version of read_from_file().
import argparse import argparse
import logging import logging
import re
import sys import sys
import traceback import traceback
import types import types
...@@ -25,7 +24,6 @@ import textures.road ...@@ -25,7 +24,6 @@ import textures.road
import utils.vec2d as v import utils.vec2d as v
import utils.calc_tile as ct import utils.calc_tile as ct
import utils.log_helper as ulog import utils.log_helper as ulog
import utils.utilities as uu
# default_args_start # DO NOT MODIFY THIS LINE # default_args_start # DO NOT MODIFY THIS LINE
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
...@@ -540,6 +538,7 @@ def set_boundary(boundary_west: float, boundary_south: float, ...@@ -540,6 +538,7 @@ def set_boundary(boundary_west: float, boundary_south: float,
"""Overrides the geographical boundary values (either default values or read from file). """Overrides the geographical boundary values (either default values or read from file).
In most situations should be called after method read_from_file(). In most situations should be called after method read_from_file().
""" """
import utils.utilities as uu
try: try:
uu.check_boundary(boundary_west, boundary_south, boundary_east, boundary_north) uu.check_boundary(boundary_west, boundary_south, boundary_east, boundary_north)
except uu.BoundaryError as be: except uu.BoundaryError as be:
......
...@@ -44,6 +44,8 @@ class Boundary: ...@@ -44,6 +44,8 @@ class Boundary:
if self.not_empty: if self.not_empty:
boundaries = list() boundaries = list()
for my_list in self.nodes_lists: for my_list in self.nodes_lists:
if len(my_list) < 3:
continue
my_boundary = Polygon([transformer.to_local(n) for n in my_list]) my_boundary = Polygon([transformer.to_local(n) for n in my_list])
if my_boundary.is_valid: if my_boundary.is_valid:
boundaries.append(my_boundary) boundaries.append(my_boundary)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
shamelessly translated from calc-tile.pl shamelessly translated from calc-tile.pl
""" """
import logging import logging
from math import floor, radians from math import floor
import os import os
from typing import List, Tuple from typing import List, Tuple
import unittest import unittest
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment