1

I have a large Raster with High resolution DEM of a large area, and I need to split it into smaller squares of 500mx500m, so that I can run other raster functions on it.

Basically I'm looking for the GDAL version of what I had asked here: Is there a Raster Equivalent of the Split tool?

How Do I Split a Raster into parts using GDAL?

Devdatta Tengshe
  • 41,311
  • 35
  • 139
  • 263
  • After reading http://gis.stackexchange.com/questions/5101/how-to-cut-a-tiled-image-from-a-raster-dataset-using-gdal I would say there are two options, either you are happy with gdal2tiles or you need to make your script with gdalwarp... – Miro Sep 09 '15 at 06:34
  • Use gdal_translate http://www.gdal.org/gdal_translate.html with -projwin or mayby with -srcwin. You must make a script for feeding the changing parameters or just create a batch file with own command for each tile. Gdalwarp works naturally as well but because you do not warp then gdal_translate is probably faster. – user30184 Sep 09 '15 at 06:47
  • @Miro: Gdal2Tiles create TMS tiles, which is not what I'm looking for – Devdatta Tengshe Sep 09 '15 at 06:53
  • @user30184 - how do you achieve it with gdal_trnaslate, using -projwin ulx uly lrx lry to make tiles? I am taking back the gdal2tiles option, because it can't be used in this case. Reading min/max and loop through with gdalwarp (or gdal_translate) seems like way to do this. Or do it with some other python libraries... – Miro Sep 09 '15 at 06:55
  • Just by working it out. Write ulx uly lrx lry and some name for first tile, edit extents and give a new name for the second tile. Excel helps with calculating the ulx uly lrx lry values. With -srcwin it is easier because when you have selected the tilesize you need only edit the xoff and yoff values. So the fist tile in this case would be 0 0 500 500 and next ones 500 0 500 500, 1000 0 500 500, 1500 0 500 500 until the first row of tiles is full. Then use 500 as yoff and continue. – user30184 Sep 09 '15 at 07:04
  • I forget to write that if the raster is huge, calling gdal_translate or gdalwarp in loop in batch script or as subprocess might be a killer, really not sure if gdal is optimized to read from raster only the part which you want extract. – Miro Sep 09 '15 at 07:05
  • 1
    Of course GDAL is made to read raster in an effective way. However, your raster must be in some format that supports fast access to arbitrary place in the image. For example tiled GeoTIFF, ECW, JPEG200 made with suitable compression options, and ERDAS img are good. If you have XYZ grid it is better to convert it into tiled GeoTIFF first. – user30184 Sep 09 '15 at 07:25

0 Answers0