Mapping Hacks

by Schuyler Erle, Rich Gibson and Jo Walsh

« Free Map India, 2008 A credit for a name »

Using GDAL to make little images from big ones

February 19th, 2008 by Rich

A member of the Geowanking list asked for advice on pulling 700×700 element chunks out of a 50,000×50,000 element raster file.

And doing it in under 10 seconds, please.  That brings up the magical GDAL tools.  The Geodata Abstraction Library.  This is a set of libraries and command line tools which let you do just about anything you want with most any Raster (and with the included OGR tools Vector)  data format you might find.

I’ve been using the GDAL tools to manage the large TIFF images I’ve been generating with the Gigapan Panoramas which I’ve been taking.

The Gigapan project treats gigapixel and up images the same as mapping tiles, and uses a slightly modified version of the Flash Earth Browser by Paul Neave to let you pan and zoom in a large tiled panorama the way you navigate map tiles.

I’ve been spending a lot of time on Gigapans, and I’ll write more on them, and their intersections with mapping, later.

But back to the problem at hand…Using a 1.83 GHz Intel Core Duo Mac Mini with 1 GB RAM the  gdal_translate utility  grabbed a
700 x 700 window from a 63434 x 11679 tiff and wrote it out to a jpeg in about 5 seconds.

Example: to grab a 700×700 pixel window from near the middle of a tif image and write that window  to jpeg:
gdal_translate -srcwin 31000 5000 700 700 -of jpeg p2.tif out.jpg

To shrink an image to 5% of original size (took about 13 seconds)
gdal_translate -outsize 5% 5% -of jpeg p2.tif out.jpg
GDAL tools are at: http://gdal.org.  You can download them as part of the precompiled binary  FWTools at http://fwtools.maptools.org/

Posted in Uncategorized |

You can follow any responses to this entry through the RSS 2.0 feed. Trackback from your own site.


Leave a Reply

You must be logged in to post a comment.


Entries (RSS) and Comments (RSS).