I copied the code and tried to run it, it runs the for loop the cmd says "100.. done" but there aren't any files in the set directory. Could be there any problem with the permission? If yes, how can I elevate a QGIS Python addon?
def start_splitting_tiles(self):
in_path = self.dlg.currently_choosen.toPlainText()
input_filename = in_path
while (input_filename.find("/") != -1):
input_filename = input_filename[input_filename.find('/') + 1:]
print "input: "+input_filename
out_path = self.dlg.outpath.toPlainText()
#if(out_path.find('\\') != -1):
# out_path = out_path.replace("\\", "/")
out_filename = 'tile_'
print "output: "+out_path
tile_size_x = 1500
tile_size_y = 1500
ds = gdal.Open(in_path)
band = ds.GetRasterBand(1)
xsize = band.XSize
ysize = band.YSize
for i in range(0, xsize, tile_size_x):
for j in range(0, ysize, tile_size_y):
com_string = "gdal_translate -of GTIFF -srcwin " + str(i) + ", " + str(j) + ", " + str(
tile_size_x) + ", " + str(tile_size_y) + " " + str(in_path) + " " + str(
out_path) + str(out_filename) + str(i) + "_" + str(j) + ".tif"
os.system(com_string)
#os.system(input())
print "input: "+input_filename? – Joseph May 10 '17 at 10:00in_path? Is that the full path to the file or only to the directory? – Joseph May 10 '17 at 10:07gdal_translate -of GTIFF -srcwin 0, 0, 1500, 1500 C:/Users/Jaspo/Desktop/test/NL330301_01_Schum.tif C:\Users\Jaspo\Desktop\Diplom\testzieldesttile_0_0.tifthere was a missing "/" so he saved all the tiles into a wrong destination – Jaspo May 10 '17 at 10:23