2013-11-25 39 views
0

我有一堆大GeoTiff文件(1.4GB,4緯度x 8經度)。切片大GeoTiff成1度瓷磚

我需要將每個切成1度lat x 1度長的瓷磚(每個瓷磚只有一點點的過量)。

下面是支持GeoTiff文件之一的gdalinfo輸出:

Driver: GTiff/GeoTIFF 
Files: index.tif 
Size is 38401, 19201 
Coordinate System is: 
GEOGCS["WGS 84", 
    DATUM["WGS_1984", 
     SPHEROID["WGS 84",6378137,298.257223563, 
      AUTHORITY["EPSG","7030"]], 
     AUTHORITY["EPSG","6326"]], 
    PRIMEM["Greenwich",0], 
    UNIT["degree",0.0174532925199433], 
    AUTHORITY["EPSG","4326"]] 
Origin = (-112.000104166666674,56.000104166666667) 
Pixel Size = (0.000208333333333,-0.000208333333333) 
Metadata: 
    AREA_OR_POINT=Area 
Image Structure Metadata: 
    INTERLEAVE=BAND 
Corner Coordinates: 
Upper Left (-112.0001042, 56.0001042) (112d 0' 0.38"W, 56d 0' 0.37"N) 
Lower Left (-112.0001042, 51.9998958) (112d 0' 0.38"W, 51d59'59.62"N) 
Upper Right (-103.9998958, 56.0001042) (103d59'59.62"W, 56d 0' 0.37"N) 
Lower Right (-103.9998958, 51.9998958) (103d59'59.62"W, 51d59'59.62"N) 
Center  (-108.0000000, 54.0000000) (108d 0' 0.00"W, 54d 0' 0.00"N) 
Band 1 Block=38401x1 Type=Int16, ColorInterp=Gray 
    NoData Value=-32767 

我想要的一切是除了大小相同。所以每個人都需要切成32塊,每塊1度x 1度。

例如,可以覆蓋:
-112.0001042,560001042至-110.9998958,54.9998958(基本上-112,56至-111,55)。

我看到像gdal_retile.py和gdal_grid的工具,但我沒有取得進展。什麼是正確的工具/命令行選項?

+0

看一看'gdal_translate',尤其是'projwin'關鍵字: http://www.gdal.org/gdal_translate.html –

回答

1

你可以在下面一個Python循環使用gdal_translate:

import os 

for ulx in range(-112,-103): 
    for uly in range(51,56): 
     os.system('gdal_translate -projwin '+str(ulx)+' '+str(uly)+' '+str(ulx+1)+' '+str(uly+1)+' index.tif index_tile_ulx_'+str(ulx)+'_uly_'+str(uly)+'.tif')