Clear Filters
Clear Filters

Why Spatial referencing information is missing or not readable directly from ENVI format data?

4 views (last 30 days)
I have created ENVI formatted data along with its header file. I can open it in ENVI software and even extracted the data using shape file manually. However, when I tried to extract the data using same shape file from MATLAB code given below;
[img, R] = readgeoraster(img_file.name);
% Verify if R contains the necessary spatial referencing information
if isempty(R)
error('Spatial referencing information is missing or not readable directly.');
end
It gives following error
Spatial referencing information is missing or not readable directly
I am attaching the ENVI header file and request you to please suggest me how to use it.
Chahar

Answers (1)

Cris LaPierre
Cris LaPierre on 8 May 2024
Edited: Cris LaPierre on 8 May 2024
After hearing from the corresponding internal team, it was discovered that the map info parameter in your headerfile is not formatted correctly for UTM projection data. Replace it with the following:
map info = {UTM, 0.500000, 0.500000, 712580.000000, 3216500.000000, 20.000000, 20.000000, 43, north, WGS-84, units=Meters}
You can then load and view your data using code similar to this:
[A, R] = readgeoraster("Bagpat_20230613T052649_7Bands.dat");
mapshow(rescale(A(:,:,[3 2 1])),R)
  3 Comments
Cris LaPierre
Cris LaPierre on 9 May 2024
Edited: Cris LaPierre on 9 May 2024
Please ask a new question, as that is a different topic from this one. Consider zipping and sharing the shapeful file when you do so people can help. You also seem to be using a different dat file. It would be helpufl to share that, too.
Include any error messages you are getting, what specific data you want to extract, etc
Your code looks very similar to what was answered in this post, so perhaps start by looking there?
gauri
gauri on 9 May 2024
I have posted a new question as follows;
https://in.mathworks.com/matlabcentral/answers/2116911-how-do-i-extract-the-multiband-data-using-shape-file

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!