GDAL-OGR

    Version as of 01:34, 15 Jan 2012

    to this version.

    Return to Version archive.

    View current version

     

     

    Example Uses

    The gdal utiltiies documentation is pretty good, but I always find myself looking for more examples to get the tools to really sing. Here's some of the best tips gleaned from the mailing list.

     

     

    Create a Composite Raster (RGB)

    > I’m looking for a way to take three equally sized input raster files in AAI/Grid format and convert each grid to a band in a single 24-bit raster file (r, g, b, respectively). Is there an easy way to accomplish this with GDAL?

    If you have a GDAL build that includes the python support, you can do
    gdal_merge.py -o stack.tif -separate a.grd b.grd c.grd

    This would stack each of the .grd files into a separate band of the output file, stack.tif.

     

    Clipping using projection coordinates

    > I'm forever getting it wrong the first two or three times when I try and
    > do the mental flipflops to get the numbers right for gdal_translate.
    > Can someone tell me what the ogr order is right now and I
    > can do up a cheat sheet?

    ogrinfo and gdalinfo report: xmin ymin xmax ymax
    projwin requires ulx uly lrx lry so the conversion is:

       xmin = ulx
       ymin = lry
       xmax = lrx
       ymax = uly
    

    gdal_translate -projwin %xmin% %ymax% %xmax% %ymin% in.tif out.rif

     

     

     

     

        Send feedback