I'm trying to better understand GeoTransform. For getting the extents of a raster, I've seen solutions posted such as below. But doesn't this only account for perfectly square rasters? From my understanding it gets the upper left x and y geographical positions, gets the geographical distance covered by an individual pixel, and the amount of pixels.
import gdal from gdalconst import GA_ReadOnly data = gdal.Open('C:/Temp/myimage.tif', GA_ReadOnly) geoTransform = data.GetGeoTransform() minx = geoTransform maxy = geoTransform maxx = minx + geoTransform * data.RasterXSize miny = maxy + geoTransform * data.RasterYSize print [minx, miny, maxx, maxy] data = None upper_left = [minx, maxy] bottom_left = [minx, miny] upper_right = [maxx, maxy] bottom_right = [maxx, miny]
If you were attempting to redraw the shape with this, it would only work for perfect squares right? If the lower left corner is shifted slightly further left from the top left, it wouldn't be accounted for?
When I do gdalinfo, I get the following results for corner coordinates:
Upper Left ( 248061.434, 4620818.949) ( 72d 1'39.76"W, 41d41'57.41"N)
Lower Left ( 248061.434, 4553370.949) ( 71d59'58.78"W, 41d 5'33.28"N)
Upper Right ( 275337.434, 4620818.949) ( 71d42' 1.04"W, 41d42'26.81"N)
Lower Right ( 275337.434, 4553370.949) ( 71d40'30.95"W, 41d 6' 2.06"N)
Center ( 261699.434, 4587094.949) ( 71d51' 2.32"W, 41d24' 0.34"N)