New answers tagged

4

It looks like your issue might be caused by as simple syntax error. The correct syntax is if __name__ == '__main__': (with double underscores around main) That if statement is essentially used to check whether the file is being executed as a standalone script or if it has been imported by some other python script. Anything inside the if statement will only ...


1

Its easier to solve this issue by using the 'identify' method of QgsRasterDataProvider and a little bit of GDAL Python. I used a very simple rasters (20 x 20) to test my approach. The first one was an aleatory raster with values between 1 and 100. The another one was the 'minimum' raster; whose values were all 50. It looks like this: The code is: from ...


3

It looks like your issue here is with your function x. Since nothing is being returned from the function, you cannot iterate over it. I would suggest making use of the yield keyword. This will return a generator which you can iterate over. Essentially it returns each result in the function in turn. For example: def a_function(x): for i in range(x): ...



Top 50 recent answers are included