Esempio n. 1
0
 def get_file_output(raw_file, simple_file):
     simplifier = simplify.GeojsonSimplifier()
     simplifier.read_geojson(os.path.join(TEST_DATA_DIR, raw_file))
     simplifier.simplify()
     result = simplifier.geojson
     file = os.path.join(TEST_DATA_DIR, simple_file)
     with open(file, 'r') as f:
         expected_result = geojson.load(f)
     return result, expected_result
Esempio n. 2
0
 def test_larger_adjustement(self):
     """Tests a moderate adjustement (removed point is poorly approximated
     by the resulting line) on a small, custom-made Polygon.
     """
     polygon_ex = {
         'type': 'Polygon',
         'coordinates': [[[[1, 0], [2, 5], [3, 0.25], [4, -0.5], [5, 0.1]]]]
     }
     polygon_simple_ex = {
         'type': 'Polygon',
         'coordinates': [[[[1, 0], [2, 5], [5, 0.1]]]]
     }
     simplifier = simplify.GeojsonSimplifier()
     simplifier.geojson = polygon_ex
     simplifier.simplify(epsilon=2)
     self.assertDictEqual(simplifier.geojson, polygon_simple_ex)
Esempio n. 3
0
 def test_small_adjustement(self):
     """Tests a small adjustement (removed point is very well approximated
     by the resulting line) on a small, custom-made Polygon.
     """
     polygon_ex = {
         'type': 'Polygon',
         'coordinates': [[[[1, 1], [2, 2], [3, 3.1], [4, 0]]]]
     }
     polygon_simple_ex = {
         'type': 'Polygon',
         'coordinates': [[[[1, 1], [3, 3.1], [4, 0]]]]
     }
     simplifier = simplify.GeojsonSimplifier()
     simplifier.geojson = polygon_ex
     simplifier.simplify(epsilon=0.1)
     self.assertDictEqual(simplifier.geojson, polygon_simple_ex)
Esempio n. 4
0
 def __init__(self):
     self.downloader = download.GeojsonDownloader()
     self.simplifier = simplify.GeojsonSimplifier()
     self.simple_geojsons = {}
     self.eps = 0.01