Skip to content

Commit

Permalink
Added worldfile export functionality when saving rectified images. Al…
Browse files Browse the repository at this point in the history
…so added save shorelines as CSV files
  • Loading branch information
Mitchell Harley committed Jul 4, 2022
1 parent 313687b commit dc88594
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions GUI/CSPGrectifyImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@
imwrite(flipud(Iplan),fullfile(rect_path,rect_name))
fname_rectified_mat = strrep(rect_name,'.jpg','.mat');
save(fullfile(rect_path,fname_rectified_mat),'xgrid', 'ygrid', 'Iplan', 'metadata')
%Write world file
W = [siteDB.rect.res 0 0 -siteDB.rect.res min(xgrid)+siteDB.origin.eastings max(ygrid)+siteDB.origin.northings]'; %World file convention. Need to specify NW corner. 0 rotation as aligned N-S
fname_rectified_jpw = strrep(rect_name,'.jpg','.jpw');
save(fullfile(rect_path,fname_rectified_jpw),'W', '-ascii')
end

data.tide_level = tide_level;
Expand Down
9 changes: 9 additions & 0 deletions GUI/CSPGsaveShoreline.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ function CSPGsaveShoreline(handles)
savefname = strrep(savefname,'timex','shoreline');
savefname = strrep(savefname,'.jpg','.mat');
save(fullfile(savedir,savefname),'sl')

%Also save CSV file.
data = sl.UTM';
savefname = strrep(savefname,'.mat','.csv');
fid = fopen(fullfile(savedir,savefname),'w');
fprintf(fid,'%s\r\n','Eastings,Northings,Elevation')
fprintf(fid,'%0.2f,%0.2f,%0.2f\r\n',data)
fclose(fid)

disp('Shoreline saved to DB!')
end
end
Expand Down

0 comments on commit dc88594

Please sign in to comment.