@@ -134,6 +134,8 @@ def __init__(self, filepath, extra, index_box, index_properties={}):
134134 self .jpeg_export_quality = extra .get ('jpeg_export_quality' , 75 )
135135 self .warp_jpeg_export_quality = extra .get ('warp_jpeg_export_quality' , 75 )
136136 self .warp_output_height = extra .get ('warp_output_height' , 6500 )
137+ self .warp_resampling_method = extra .get ('warp_resampling_method' , 'bilinear' )
138+ self .export_resampling_method = extra .get ('export_resampling_method' , 'nearest' ) # nearest for backwards compatibility
137139
138140
139141 self .color_map = {
@@ -1790,15 +1792,17 @@ def warp_file(self, box, cline_file, georef_file, f_file, jpeg_quality, set_reso
17901792 warp_quality_config .update ({'TILED' : 'YES' })
17911793 warp_quality_options = ' ' .join ([ f'-co { k } ={ v } ' for k ,v in warp_quality_config .items () ])
17921794 if not set_resolution :
1793- reproj_options = f'-tps - ts 0 { self .warp_output_height } -r bilinear -t_srs "EPSG:3857"'
1795+ res_options = f'-ts 0 { self .warp_output_height } '
17941796 else :
17951797 res = self .get_resolution ()
17961798 if res == 'auto' :
1797- reproj_options = '-tps -r bilinear -t_srs "EPSG:3857" '
1799+ res_options = ''
17981800 else :
17991801 if type (res ) is not list :
18001802 res = [res , res ]
1801- reproj_options = f'-tps -tr { res [0 ]} { res [1 ]} -r bilinear -t_srs "EPSG:3857"'
1803+ res_options = f'-tr { res [0 ]} { res [1 ]} '
1804+
1805+ reproj_options = f'-tps { res_options } -r { self .warp_resampling_method } -t_srs "EPSG:3857"'
18021806
18031807 #nodata_options = '-dstnodata 0'
18041808 nodata_options = '-dstalpha'
@@ -1903,7 +1907,8 @@ def export_gtiff(self, filename, out_filename, jpeg_export_quality):
19031907 mask_options = '--config GDAL_TIFF_INTERNAL_MASK YES -b 1 -b 2 -b 3 -mask 4'
19041908 perf_options = '--config GDAL_CACHEMAX 512'
19051909 cog_options = '-of COG'
1906- cmd = f'gdal_translate { perf_options } { mask_options } { creation_opts } { cog_options } { filename } { out_filename } '
1910+ resampling_options = f'-r { self .export_resampling_method } '
1911+ cmd = f'gdal_translate { perf_options } { mask_options } { creation_opts } { cog_options } { resampling_options } { filename } { out_filename } '
19071912 self .run_external (cmd )
19081913
19091914 def export (self ):
0 commit comments