[GIS] How to cut a ’tiled image’ from a raster dataset using GDAL

gdaltiles

I am working on an app that needs to create tiles (jpeg) from a given raster dataset. My initial inclination was to use gdal2tiles.py, but its performance seems like it could be improved.

That leads me to ask the following question: What would be the fastest way to cut a 'tiled image' from a raster dataset using GDAL? And by 'tiled image', I mean just a simple jpeg or png.

In my prototype, I use the MapServer C# MapScript bindings to do the job. That is, I create a map object, loop through all the tile bounds I need to cut, set the map objects extent, and then save the resulting image. The performance of this approach is significantly better than that of gdal2tiles.py, but I am wondering if I use GDAL directly if I can't make it even faster. Can anyone suggest a similar workflow with GDAL methods?

EDIT: After some more research today, I found the answer right in front of me. If you have downloaded FWTools, the csharp\apps folders contains a number of classes to demonstrate the C# GDAL bindings. In my case the GDALRead.cs and GDALReadDirect.cs were what I was looking for.

Best Answer

Someone has spent the time to make gdal2tiles.py use multiple processors: parallel gdal

I have used this and it does seem to work. It successfully utilizes all 4 cores to 100% and cuts the total time to create the tiles down to 1/4th of the original time.