GDAL-OGR

    GDAL/OGR is arguably the best collection of conversion utilities & programming libraries for geospatial data we have today. With roots and  centre strongly established in the open source ecosystem, it's also incorporated into closed source giants such as ESRI's ArcGIS and ERDAS' ERMapper.

    For gdal and ogr utilities on Windows, the suggested starting point is OSGeo4W.

     

    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