Tuesday, 13 December 2016

tiles - How to cut a 'tiled image' from a raster dataset using GDAL?


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.





No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...