Geotiffwrite doesn't show any image
Show older comments
Hi, I was making a script to extract xyz data from surface figure and write it into geotiff file. The script works and create an image, however when i opened it windows preview said it's corrupted and if i opened it in global mapper the file only show a single color image but with the right coordinates. Here is the script
ch=gcf;
ch = findobj(ch,'Type','surface');
ch=get(gca,'ch');
x=get(ch,'Xdata');
y=get(ch,'Ydata');
z=get(ch,'Zdata');
z{1,1}=[];
z1=cell2mat(z);
yin=min(cell2mat(y));
yax=max(cell2mat(y));
xin=min(cell2mat(x));
xax=max(cell2mat(x));
xmin=min(xin(:));
xmax=max(xax(:));
ymin=min(yin(:));
ymax=max(yax(:));
s=size(z1);
R = georefcells([ymin,ymax],[xmin,xmax],s);
tiffile='11test.tif' ;
geotiffwrite(tiffile,z1,R)
[z1,R] = geotiffread(tiffile);
Here is the screenshot of the image in GlobalMapper:

Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!