Hi
I am using the Python GDAL API and looking at a simple TIFF image with a test
program:
from osgeo import gdal
dataset = gdal.Open('test-gdal.tif')
transform=dataset.GetGeoTransform()
nx=dataset.RasterXSize
ny=dataset.RasterYSize
data=dataset.ReadAsArray()
print(f"Raster xsize, ysize ({nx},{ny})")
print(f"ReadAsArray dimensions {data.shape}")
print(f"GeoTransform: {transform}")
The output is:
test_python_api.py
Raster xsize, ysize (3,4)
ReadAsArray dimensions (4, 3)
GeoTransform: (22.15, 0.7, 0.0, -69.5, 0.0, 1.0)
I am confused that the array appears transposed from the raster x,y size.
Is this always the cased. As far as I can tell the geotransform is assuming
x,y (0-2,0-3 values) to map indices to location, which is what I want to do.
Can I assume that the array is always transposed? Or if not how do I identify
when this is the case?
Many thanks in advance
Chris Crook
Land Information New Zealand
________________________________
This message contains information, which may be in confidence and may be
subject to legal privilege. If you are not the intended recipient, you must not
peruse, use, disseminate, distribute or copy this message. If you have received
this message in error, please notify us immediately (Phone 0800 665 463 or
[email protected]) and destroy the original message. LINZ accepts no
responsibility for changes to this email, or for any attachments, after its
transmission from LINZ. Thank You.
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev