Pixel Value according to location

Hello I have posted this question before at:
https://www.mathworks.com/matlabcentral/answers/369563-extracting-the-values-of-pixel-at-certain-points?s_tid=prof_contriblnk
I'm very lost in what I have to do, below is my question:
I have a large raster layer that has aridity values assigned to each pixel. I also have latitude and longitude data of some locations in USA. I would like to know the pixel value according to my latitude and longitude locations . I first clipped the raster to my area of interest (USA) in Arcmap the I converted my clipped raster in to a .tif file then I did the following, where i convert these pixels into lat and lon but I am having problems finishing the code. I'm not sure what to do. Or is there a different approach. Any suggestions?
I = imread('ai_yr1.tif');
info = geotiffinfo('ai_yr1.tif');
height = info.Height; % Integer indicating the height of the image in pixels
width = info.Width; % Integer indicating the width of the image in pixels
[rows,cols] = meshgrid(1:height,1:width);
[ADlat,ADlon] = pix2latlon(info.RefMatrix, rows, cols);
I unfortunately can't attach my .tif file but I have attached a picture to give an idea of what I have
Thank You!!

3 Comments

We were waiting for your file to be attached; you should merge this question with your original at https://www.mathworks.com/matlabcentral/answers/369563-extracting-the-values-of-pixel-at-certain-points
IF you have geotiff file in hand..it means you have all the information in hand...what problem you are facing?
I wanted to know the pixel value at specific latitudes and longitudes, I have posted a dropbox link at my original question:
https://www.mathworks.com/matlabcentral/answers/369563-extracting-the-values-of-pixel-at-certain-points?s_tid=prof_contriblnk

Sign in to comment.

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Asked:

on 28 Nov 2017

Edited:

on 29 Nov 2017

Community Treasure Hunt

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

Start Hunting!