Re: [gdal-dev] Python API ReadAsArray axis order

2022-12-04 Thread Even Rouault
Chris, ReadAsArray() returns a NumPy array, and the first dimension in NumPy is the slowest varying one, that is y. GDAL's geotransform is Xgeoref = gt[0] + column * gt[1] + line * gt[2] Ygeoref = gt[3] + column * gt[4] + line * gt[5] and GDAL's Raster API have their arguments with column f

Re: [gdal-dev] Python API ReadAsArray axis order

2022-12-04 Thread Javier Jimenez Shaw
Hi Chris I am not an expert in python. But I had similar problems in other environments. At https://gdal.org/api/python/osgeo.gdal.html you can see that in many functions the numpy array returned is always in the form "array[y][x]". Looks like the shape in stored as "row,cols", not as "x,y". Chee

[gdal-dev] Python API ReadAsArray axis order

2022-12-04 Thread Chris Crook
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