Forum

Author Topic: Default value of blockh and blockw that doesn't tile the orthophoto/DEM?  (Read 4013 times)

MMNN

  • Newbie
  • *
  • Posts: 17
    • View Profile
Is there a way to set blockh and blockw to some default value that ensures the orthophoto is not divided into blocks? I want to ask the user if the orthophoto should be blocked or not.

Code: [Select]
chunk.exportOrthomosaic(path, format=fmat, projection = proj, blockw = blockSize, blockh = blockSize, tiff_compression = compression, tiff_big = bigTiff):
I know I can just use an if-sentence and have to versions of exportOrthomosaic with and without blockh and blockw, but I also have an if-sentence for the format, and I might get more, so I would like to avoid a whole tree of if-sentences with all combinations of possibilities.

Any help is much appreciated  :)

Gall

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Well, an easier way to do it is to populate a dictionary based on your conditions with the parameters (key = parameter name and value = the parameter value) and simply unpack it when you call the function.
Code: [Select]
parameters = {...some default parameters...}

parameters['format'] = fmat
if fmat == 'tif':
    parameters['tiff_compression'] = compression
    parameters['tiff_big'] = bigTiff
if blocked:
    parameters['blockw'] = blockSize
    parameters['blockh'] = blockSize

chunk.exportOrthomosaic(path, **parameters):