I have a raster that needs to be split into tiles (each tile a new raster). I have a Shapefile with multiple polygons (these polygons are how I want the raster split).

How do I do this using GDAL?

  • 2
    Plenty. Possibly the easiest would be to add Xmin, Ymin, Xmax and Ymax fields for each grid then populate with field calculator, export to Text and make into a batch file. Do you have any python/coding experience? This can be done with existing tools and a bit of find&replace but would (possibly) be easier to script - or at least less typing. Jul 14, 2015 at 4:02

2 Answers 2


You can split the image to small tiles by the size of the (tile_size) using a code like this one:

file_path,file_name = {{put-yor-path-and-name-here}}
gdal_img = gdal.Open(img)

RasterXSize = gdal_img.RasterXSize
RasterYSize = gdal_img.RasterYSize
transform = gdal_img.GetGeoTransform()
minX = transform[0]
maxY = transform[3]
img_pixelWidth = transform[1]

img_out = str(path) + "\\" + str(out_img_name) + r".TIF"          

  • this will cut small tile from the big image given the parameters startX = the coord of start splitting and sizeX how many pix to cut Oct 22, 2017 at 9:12

You can use the Select by Attributes tool to select all of the raster features inside the shapefiles. Then right click on the raster in the Table of Contents and go to Data > Export to CAD.

  • This answer is not correct. If you are selecting features within features in the shape file you would use select by location (Vector>research tools>select by location) but that works for vector layers and the question regards splitting raster layers
    – Sethinacan
    Jan 22, 2016 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.