Monday 28 September 2015

How do I access GeoTransform array from gdal on the command line?



I'm using the gdal library via OSGeo for windows, and I was just wondering how to access the geotransform array for a .ecw file.



Answer



This can be found from gdalinfo, except it has three forms:




  1. If rotation / shear coefficients (adfGeoTransform[2] and adfGeoTransform[4]) are zero, the output is simplified:
    Origin = (%.15f,%.15f) % adfGeoTransform[0], adfGeoTransform[3]
    Pixel Size = (%.15f,%.15f) % adfGeoTransform[1], adfGeoTransform[5]





  2. If rotation / shear coefficients are non-zero, the full 6-coefficients are shown:
    GeoTransform =
    %.16g, %.16g, %.16g % adfGeoTransform[0], adfGeoTransform[1], adfGeoTransform[2]
    %.16g, %.16g, %.16g % adfGeoTransform[3], adfGeoTransform[4], adfGeoTransform[5]




  3. If there is no GeoTransform information, then neither of the above two forms are shown.




The order of coefficients used by GDAL are important, and are documented here.



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...