def latlon_tif_to_pixel(lat,lon): import rasterio import pyproj import numpy as np filepath = 'ndvi.tif' #filepath = 'Tile_TCI.jp2' with rasterio.open(filepath) as src: utm = pyproj.Proj(src.crs) lonlat = pyproj.Proj(init='epsg:4326') east,north = pyproj.transform(lonlat,utm,lon,lat) row,col =src.index(east,north) return row,col