How can I obtain pixel value from map co-ordinate [longitude, latitude] for image of band count 1?

338 Views Asked by At

so I am using Landsat-8 image of band-4. I want to obtain the n-array index for given longitude and latitude values. I have tried below code

xs=np.array([92.8])
ys=np.array([26.6])
row,col=rasterio.transform.rowcol(src.transform,xs,ys)
print(row,col)
>>[99709] [-11627]     #output from the code 

Output obtained is wrong because size of my image is (7791, 7651) and these values are out of index. Can anyone please suggest me some changes to be made.

0

There are 0 best solutions below