使用python合并地理参考TIFF图像

时间:2018-08-24 09:26:58

标签: python image-processing gis tiff

我有大量的地理参考图像,我正在尝试将其合并。

我已经尝试过 georasters

如果两个瓷砖彼此不靠近,我将面临这个问题:它给了我以下错误。

  File "anaconda3/lib/python3.5/site-packages/georasters/georasters.py", line 1212, in union
raise RasterGeoError('Rasters need to have same pixel sizes. Use the aggregate or dissolve functions to generate correct GeoRasters')
georasters.georasters.RasterGeoError: Rasters need to have same pixel sizes. Use the aggregate or dissolve functions to generate correct GeoRasters

以下代码是我尝试过的代码。这仅适用于连接的图像,即使合并后也没有地理配准

import os
import georasters as gr
import matplotlib.pyplot as plt

DATA = "/home/gulve/Priority engine/test"

# Import raster
raster = os.path.join(DATA, '5.4272461_49.5703124_5.4492187_49.5593262.tif')

data = gr.from_file(raster)
data3 = gr.from_file('5.4492188_49.5263671_5.4711914_49.5153809.tif')

# (xmin, xsize, x, ymax, y, ysize) = data.geot

data3 = data.merge(data3)

# Plot both parts and save them
data3.plot()
plt.savefig(os.path.join(DATA, 'data3.tif'), bbox_inches='tight')

如果你们可以帮助我获得地理参考的合并图像,还需要一个小帮助

0 个答案:

没有答案