I have the georeferenced image with coordinates values like (475224.0, 4186282.0).The dimension of my image is (647, 2180). ie there are 647 columns and 2180 rows. I would like to take the coordinate values into a numpy array with size (647, 2180), so that I will get the coordinates of each pixel as an array. I code like below.
rr = rasterio.open(fname) #fname is the georefered image
col = rr.width
row = rr.height
coord = np.empty(shape=(col,row),dtype=rr.dtypes[0])
for i in range(0,col):
for j in range(0,row):
coord[i,j] = rr.transform*(i,j)
The problem is rr.transform*(i,j) will give values like (475224.0, 4186282.0). How to save it into a cell. For the above program, I'm getting error like below
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 3, in coord[i,j] = rr.transform*(i,j) ValueError: setting an array element with a sequence.