def profileMerge(self, input_dir): self.__profilePrep(input_dir) print('Merging...') Io.deleteFile(self.path_provider.merged_file) Io.makeDirectories(self.path_provider.output_merged_path) Tr.gdalMerge(input_data=self.path_provider.output_data_path, out_file=self.path_provider.merged_file)
def basicMerge(self, input_dir): Io.deleteDirectory(self.path_provider.output_data_path) Io.makeDirectories(self.path_provider.output_data_path) Io.copyFiles(src=input_dir, dest=self.path_provider.output_data_path, file_names=self.file_names) print('Merging...') Io.deleteFile(self.path_provider.merged_file) Io.makeDirectories(self.path_provider.output_merged_path) Tr.gdalMerge(input_data=self.path_provider.output_data_path, out_file=self.path_provider.merged_file, is_pct=True)
def basicTile(self, is_pct, zoom): print('Translating') Io.deleteFile(self.path_provider.translated_file) Tr.gdalTranslate(input_file=self.path_provider.merged_file, out_file=self.path_provider.translated_file, is_pct=is_pct) print('Warping') Io.deleteFile(self.path_provider.warped_file) Tr.gdalWarp(in_file=self.path_provider.translated_file, out_file=self.path_provider.warped_file) print('Tiling') Io.deleteDirectory(self.path_provider.output_tiles_path) Io.makeDirectories(self.path_provider.output_tiles_path) Tr.gdal2Tiles(in_file=self.path_provider.warped_file, out_dir=self.path_provider.output_tiles_path, zoom=zoom)
# additional_options = ['-a_nodata', '255', # '-pct'] # else: # additional_options = ['-a_nodata', '0', # '-co', 'PHOTOMETRIC=RGB'] # params = additional_options + [ # '-of', 'GTiff', # '-co', 'COMPRESS=DEFLATE', # '-co', 'BIGTIFF=YES', # '-o', merged_file # ] # params = params + files_to_merge # subprocess.call(["python", scripts_path + "gdal_merge.py"] + params) print('Translating...') Io.deleteFile(translated_file) if is_pct: additional_options = ['-expand', 'rgb'] else: additional_options = ['-b', '1', '-b', '2', '-b', '3'] params = additional_options + [ '-ot', 'Byte', '-of', 'GTiff', '-a_srs', 'EPSG:27700', '-a_nodata', '0', '-co', 'COMPRESS=DEFLATE', '-co', 'BIGTIFF=YES', merged_file, translated_file ] subprocess.call([env_path + 'Library\\bin\\gdal_translate.exe'] + params) warp_in_file = translated_file