Geographic Information Systems Asked on July 19, 2021
I am trying to resample my data based on "sum" resampling method. But unfortunately, I do not see this in the drop down menu in Warp.I am running a GDAl version 3.1, but it does not have this function. Can someone please help me figure out how to "install" this?
The method is not in the GUI but you may patch manually the file warp.py
as it should be in a path similar to processing/algs/gdal/warp.py
The following code
def initAlgorithm(self, config=None):
self.methods = ((self.tr('Nearest Neighbour'), 'near'),
(self.tr('Bilinear'), 'bilinear'),
(self.tr('Cubic'), 'cubic'),
(self.tr('Cubic Spline'), 'cubicspline'),
(self.tr('Lanczos Windowed Sinc'), 'lanczos'),
(self.tr('Average'), 'average'),
(self.tr('Mode'), 'mode'),
(self.tr('Maximum'), 'max'),
(self.tr('Minimum'), 'min'),
(self.tr('Median'), 'med'),
(self.tr('First Quartile'), 'q1'),
(self.tr('Third Quartile'), 'q3'))
could be changed
def initAlgorithm(self, config=None):
self.methods = ((self.tr('Nearest Neighbour'), 'near'),
(self.tr('Bilinear'), 'bilinear'),
(self.tr('Cubic'), 'cubic'),
(self.tr('Cubic Spline'), 'cubicspline'),
(self.tr('Lanczos Windowed Sinc'), 'lanczos'),
(self.tr('Average'), 'average'),
(self.tr('Mode'), 'mode'),
(self.tr('Maximum'), 'max'),
(self.tr('Minimum'), 'min'),
(self.tr('Median'), 'med'),
(self.tr('First Quartile'), 'q1'),
(self.tr('Third Quartile'), 'q3'))
if GdalUtils.version() >= 3010000:
self.methods = list(self.methods)
self.methods.append((self.tr('Sum'), 'sum'))
self.methods = tuple(self.methods)
PS: to keep a tuple, I cast it to a list to append Sum method and convert it back to tuple. Quite dirty...
A similar method could be applied for rms
sampling method but testing GDAL version to 3.3 and using insert
to get the same position in the list as the documentation (https://gdal.org/programs/gdalwarp.html)
If it was a PR, I would also need to look at translation of the new string to be translated maybe.
Answered by ThomasG77 on July 19, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP