How do I convert latitude and longitude to rows and columns on a geotiff?

4 views (last 30 days)
I am trying to analyze a specific region of interest (ROI) on a very large geotiff. The image is from landsat 7. I want to input the latitude and longitudes of the top left and bottom right corners of the region I am interested in. I want to then use that data to find the rows and columns that I will be averaging.
I have tried to use functions such as latlon2pix. The pixel locations did not help me (the values I received didn't make sense). The setpostn function gives me errors.
Any help would be greatly appreciated!

Answers (2)

Chad Greene
Chad Greene on 16 Mar 2015
If latlon2pix returned funny numbers, I'd guess there's something wrong with your georeferencing matrix.
If you only need a small region of a Landsat image, geoimread may be all you need.

Calvin Kielas-Jensen
Calvin Kielas-Jensen on 20 Mar 2015
Thank you very much for the quick reply. I tried using that and unfortunately it does not seem to like the latitude and longitude values that I am providing. I will look through the code to see if I am missing something. This is proving to be quite a difficult problem for me.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!