Beispiel #1
0
    def test_average_resampling_not_supported_in_old_gdal(self, mock_gdal):
        mock_gdal = self._setup_gdal_patch(mock_gdal)
        del mock_gdal.RegenerateOverview
        self.DEFAULT_ATTRDICT_OPTIONS['resampling'] = "average"

        with self.assertRaises(SystemExit):
            gdal2tiles.options_post_processing(self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", "/bar/")
Beispiel #2
0
    def test_average_resampling_not_supported_in_old_gdal(self, mock_gdal):
        mock_gdal = self._setup_gdal_patch(mock_gdal)
        del mock_gdal.RegenerateOverview
        self.DEFAULT_ATTRDICT_OPTIONS['resampling'] = "average"

        with self.assertRaises(SystemExit):
            gdal2tiles.options_post_processing(self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", "/bar/")
Beispiel #3
0
    def test_antialias_resampling_not_supported_wout_numpy(self):
        if hasattr(gdal2tiles, "numpy"):
            del gdal2tiles.numpy

        self.DEFAULT_ATTRDICT_OPTIONS['resampling'] = "antialias"

        with self.assertRaises(SystemExit):
            gdal2tiles.options_post_processing(self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", "/bar/")
Beispiel #4
0
    def test_antialias_resampling_not_supported_wout_numpy(self):
        if hasattr(gdal2tiles, "numpy"):
            del gdal2tiles.numpy

        self.DEFAULT_ATTRDICT_OPTIONS['resampling'] = "antialias"

        with self.assertRaises(SystemExit):
            gdal2tiles.options_post_processing(self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", "/bar/")
Beispiel #5
0
    def test_title_default_to_input_filename_if_not_set(self):
        input_file = "foo/bar/fizz/buzz.tiff"

        options = gdal2tiles.options_post_processing(
            self.DEFAULT_ATTRDICT_OPTIONS, input_file, "baz")

        self.assertEqual(options.title, os.path.basename(input_file))
Beispiel #6
0
    def test_title_default_to_input_filename_if_not_set(self):
        input_file = "foo/bar/fizz/buzz.tiff"

        options = gdal2tiles.options_post_processing(
            self.DEFAULT_ATTRDICT_OPTIONS, input_file, "baz")

        self.assertEqual(options.title, os.path.basename(input_file))
Beispiel #7
0
    def test_title_is_untouched_if_set(self):
        title = "fizzbuzz"
        self.DEFAULT_ATTRDICT_OPTIONS['title'] = title

        options = gdal2tiles.options_post_processing(
            self.DEFAULT_ATTRDICT_OPTIONS, "bar.tiff", "baz")

        self.assertEqual(options.title, title)
Beispiel #8
0
    def test_title_is_untouched_if_set(self):
        title = "fizzbuzz"
        self.DEFAULT_ATTRDICT_OPTIONS['title'] = title

        options = gdal2tiles.options_post_processing(
            self.DEFAULT_ATTRDICT_OPTIONS, "bar.tiff", "baz")

        self.assertEqual(options.title, title)
Beispiel #9
0
    def test_url_ends_with_the_output_folder_last_component(self):
        output_folder = "foo/bar/fizz"
        url = "www.mysite.com/storage"
        self.DEFAULT_ATTRDICT_OPTIONS['url'] = url

        options = gdal2tiles.options_post_processing(
            self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", output_folder)

        self.assertEqual(options.url, url + "/fizz/")

        # With already present trailing slashes
        output_folder = "foo/bar/fizz/"
        url = "www.mysite.com/storage/"
        self.DEFAULT_ATTRDICT_OPTIONS['url'] = url

        options = gdal2tiles.options_post_processing(
            self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", output_folder)

        self.assertEqual(options.url, url + "fizz/")
Beispiel #10
0
    def test_url_ends_with_the_output_folder_last_component(self):
        output_folder = "foo/bar/fizz"
        url = "www.mysite.com/storage"
        self.DEFAULT_ATTRDICT_OPTIONS['url'] = url

        options = gdal2tiles.options_post_processing(
            self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", output_folder)

        self.assertEqual(options.url, url + "/fizz/")

        # With already present trailing slashes
        output_folder = "foo/bar/fizz/"
        url = "www.mysite.com/storage/"
        self.DEFAULT_ATTRDICT_OPTIONS['url'] = url

        options = gdal2tiles.options_post_processing(
            self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", output_folder)

        self.assertEqual(options.url, url + "fizz/")
Beispiel #11
0
    def test_url_stays_empty_if_not_passed(self):
        options = gdal2tiles.options_post_processing(
            self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", "baz")

        self.assertEqual(options.url, "")
Beispiel #12
0
    def test_antialias_resampling_supported_with_numpy(self):
        gdal2tiles.numpy = True
        self.DEFAULT_ATTRDICT_OPTIONS['resampling'] = "antialias"

        gdal2tiles.options_post_processing(self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", "/bar/")
Beispiel #13
0
    def test_average_resampling_supported_with_latest_gdal(self, mock_gdal):
        self._setup_gdal_patch(mock_gdal)
        self.DEFAULT_ATTRDICT_OPTIONS['resampling'] = "average"

        gdal2tiles.options_post_processing(self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", "/bar/")
Beispiel #14
0
    def test_url_stays_empty_if_not_passed(self):
        options = gdal2tiles.options_post_processing(
            self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", "baz")

        self.assertEqual(options.url, "")
Beispiel #15
0
    def test_antialias_resampling_supported_with_numpy(self):
        gdal2tiles.numpy = True
        self.DEFAULT_ATTRDICT_OPTIONS['resampling'] = "antialias"

        gdal2tiles.options_post_processing(self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", "/bar/")
Beispiel #16
0
    def test_average_resampling_supported_with_latest_gdal(self, mock_gdal):
        self._setup_gdal_patch(mock_gdal)
        self.DEFAULT_ATTRDICT_OPTIONS['resampling'] = "average"

        gdal2tiles.options_post_processing(self.DEFAULT_ATTRDICT_OPTIONS, "foo.tiff", "/bar/")