def test_read_mapchete_input(mapchete_input): """Read Mapchete files as input files.""" config = MapcheteConfig(mapchete_input.path) area = config.area_at_zoom(5) # testpolygon = box(0.5, 1.5, 3.5, 3.5) testpolygon = wkt.loads("POLYGON ((3 1.5, 3 1, 2 1, 2 1.5, 0.5 1.5, 0.5 3.5, 2 3.5, 2 4, 3 4, 3 3.5, 3.5 3.5, 3.5 1.5, 3 1.5))") assert area.equals(testpolygon)
def test_read_input_groups(file_groups): """Read input data groups.""" config = MapcheteConfig(file_groups.path) input_files = config.params_at_zoom(0)["input"] assert "file1" in input_files["group1"] assert "file2" in input_files["group1"] assert "file1" in input_files["group2"] assert "file2" in input_files["group2"] assert "nested_group" in input_files assert "group1" in input_files["nested_group"] assert "file1" in input_files["nested_group"]["group1"] assert "file2" in input_files["nested_group"]["group1"] assert "file1" in input_files["nested_group"]["group2"] assert "file2" in input_files["nested_group"]["group2"] assert config.area_at_zoom()
def test_read_mapchete_input(mapchete_input): """Read Mapchete files as input files.""" config = MapcheteConfig(mapchete_input.path) area = config.area_at_zoom(5) testpolygon = "POLYGON ((4 1, 3 1, 2 1, 2 4, 3 4, 3 2, 4 2, 4 1))" assert area.equals(loads(testpolygon))
def test_bounds_from_input_files(files_bounds): """Read bounds from input files.""" config = MapcheteConfig(files_bounds.path) test_polygon = Polygon( [[3, 2], [4, 2], [4, 1], [3, 1], [2, 1], [2, 4], [3, 4], [3, 2]]) assert config.area_at_zoom(10).equals(test_polygon)
def test_override_bounds(zoom_mapchete): """Override bounds when construcing configuration.""" config = MapcheteConfig(zoom_mapchete.path, bounds=[3, 2, 3.5, 1.5]) test_polygon = Polygon([ [3, 1.5], [3, 2], [3.5, 2], [3.5, 1.5], [3, 1.5]]) assert config.area_at_zoom(5).equals(test_polygon)
def test_read_bounds(zoom_mapchete): """Read bounds from config file.""" config = MapcheteConfig(zoom_mapchete.path) test_polygon = Polygon([ [3, 1.5], [3, 2], [3.5, 2], [3.5, 1.5], [3, 1.5]]) assert config.area_at_zoom(5).equals(test_polygon)