How do I plot multiple DTED plots without individual axes or legends?
I’m trying to plot 4 sets of DTED (.dt2) files to create a figure that covers 2 degrees of both latitude and longitude (each .dt2 is 1 degree x 1 degree), and I want the 4 sets to be directly next to each other to create a seamless map.
I’m using the following code to load the files:
[grid_3, R3] = readgeoraster("FILENAME.dt2", "OutputType","double"); % bottom left
[grid_4, R4] = readgeoraster("FILENAME.dt2", "OutputType","double"); % bottom right
[grid_2, R2] = readgeoraster("FILENAME.dt2", "OutputType","double"); % top left
[grid_1, R1] = readgeoraster("FILENAME.dt2", "OutputType","double"); % top right
I’ve tried to combine the arrays that hold the DTED points with the following section:
grid_total = zeros([grid.totallength, grid.totalwidth]);
grid_total(1:3601, 1:3601) = grid_2; % top left
grid_total(1:3601, 3602:7202) = grid_1; % top right
grid_total(3602:7202, 1:3601) = grid_3; % bottom left
grid_total(3602:7202, 3602:7202) = grid_4; % bottom right
figure;
worldmap([30,32],[110,112]);
geoshow(grid_total, what_goes_here???, ‘DisplayType’, ‘surface’)
demcmap(grid_total);
But I’ve been unable to combine R1 through R4 to represent the 2×2 degree array. All of R’s members are read-only, so I’m not sure what to do. Using just R1, R2, etc. throws an error since it isn’t compatible with the size of grid_total.
I’ve tried using subplot to plot each DTED plot onto the same figure with this:
% first grid
figure(1);
subplot(2,2,4);
latlim4 = R4.LatitudeLimits;
lonlim4 = R4.LongitudeLimits;
worldmap(latlim4, lonlim4);
geoshow(grid_4,R4, "DisplayType", "surface");
demcmap(grid_4);
hold on
% second grid
subplot(2,2,3);
latlim3 = R3.LatitudeLimits;
lonlim3 = R3.LongitudeLimits;
worldmap(latlim3, lonlim3);
geoshow(grid_3,R3, "DisplayType", "surface");
demcmap(grid_3);
hold on
% third grid
subplot(2,2,1);
latlim2 = R2.LatitudeLimits;
lonlim2 = R2.LongitudeLimits;
worldmap(latlim2, lonlim2);
geoshow(grid_2,R2, "DisplayType", "surface");
demcmap(grid_2);
hold on
% fourth grid
subplot(2,2,2);
latlim1 = R1.LatitudeLimits;
lonlim1 = R1.LongitudeLimits;
worldmap(latlim1, lonlim1);
geoshow(grid_1,R1, "DisplayType", "surface");
demcmap(grid_1);
But they show up separated from each other with their own axes.
Does anyone have advice on how to plot all 4 of these as 1, larger, combined plot?I’m trying to plot 4 sets of DTED (.dt2) files to create a figure that covers 2 degrees of both latitude and longitude (each .dt2 is 1 degree x 1 degree), and I want the 4 sets to be directly next to each other to create a seamless map.
I’m using the following code to load the files:
[grid_3, R3] = readgeoraster("FILENAME.dt2", "OutputType","double"); % bottom left
[grid_4, R4] = readgeoraster("FILENAME.dt2", "OutputType","double"); % bottom right
[grid_2, R2] = readgeoraster("FILENAME.dt2", "OutputType","double"); % top left
[grid_1, R1] = readgeoraster("FILENAME.dt2", "OutputType","double"); % top right
I’ve tried to combine the arrays that hold the DTED points with the following section:
grid_total = zeros([grid.totallength, grid.totalwidth]);
grid_total(1:3601, 1:3601) = grid_2; % top left
grid_total(1:3601, 3602:7202) = grid_1; % top right
grid_total(3602:7202, 1:3601) = grid_3; % bottom left
grid_total(3602:7202, 3602:7202) = grid_4; % bottom right
figure;
worldmap([30,32],[110,112]);
geoshow(grid_total, what_goes_here???, ‘DisplayType’, ‘surface’)
demcmap(grid_total);
But I’ve been unable to combine R1 through R4 to represent the 2×2 degree array. All of R’s members are read-only, so I’m not sure what to do. Using just R1, R2, etc. throws an error since it isn’t compatible with the size of grid_total.
I’ve tried using subplot to plot each DTED plot onto the same figure with this:
% first grid
figure(1);
subplot(2,2,4);
latlim4 = R4.LatitudeLimits;
lonlim4 = R4.LongitudeLimits;
worldmap(latlim4, lonlim4);
geoshow(grid_4,R4, "DisplayType", "surface");
demcmap(grid_4);
hold on
% second grid
subplot(2,2,3);
latlim3 = R3.LatitudeLimits;
lonlim3 = R3.LongitudeLimits;
worldmap(latlim3, lonlim3);
geoshow(grid_3,R3, "DisplayType", "surface");
demcmap(grid_3);
hold on
% third grid
subplot(2,2,1);
latlim2 = R2.LatitudeLimits;
lonlim2 = R2.LongitudeLimits;
worldmap(latlim2, lonlim2);
geoshow(grid_2,R2, "DisplayType", "surface");
demcmap(grid_2);
hold on
% fourth grid
subplot(2,2,2);
latlim1 = R1.LatitudeLimits;
lonlim1 = R1.LongitudeLimits;
worldmap(latlim1, lonlim1);
geoshow(grid_1,R1, "DisplayType", "surface");
demcmap(grid_1);
But they show up separated from each other with their own axes.
Does anyone have advice on how to plot all 4 of these as 1, larger, combined plot? I’m trying to plot 4 sets of DTED (.dt2) files to create a figure that covers 2 degrees of both latitude and longitude (each .dt2 is 1 degree x 1 degree), and I want the 4 sets to be directly next to each other to create a seamless map.
I’m using the following code to load the files:
[grid_3, R3] = readgeoraster("FILENAME.dt2", "OutputType","double"); % bottom left
[grid_4, R4] = readgeoraster("FILENAME.dt2", "OutputType","double"); % bottom right
[grid_2, R2] = readgeoraster("FILENAME.dt2", "OutputType","double"); % top left
[grid_1, R1] = readgeoraster("FILENAME.dt2", "OutputType","double"); % top right
I’ve tried to combine the arrays that hold the DTED points with the following section:
grid_total = zeros([grid.totallength, grid.totalwidth]);
grid_total(1:3601, 1:3601) = grid_2; % top left
grid_total(1:3601, 3602:7202) = grid_1; % top right
grid_total(3602:7202, 1:3601) = grid_3; % bottom left
grid_total(3602:7202, 3602:7202) = grid_4; % bottom right
figure;
worldmap([30,32],[110,112]);
geoshow(grid_total, what_goes_here???, ‘DisplayType’, ‘surface’)
demcmap(grid_total);
But I’ve been unable to combine R1 through R4 to represent the 2×2 degree array. All of R’s members are read-only, so I’m not sure what to do. Using just R1, R2, etc. throws an error since it isn’t compatible with the size of grid_total.
I’ve tried using subplot to plot each DTED plot onto the same figure with this:
% first grid
figure(1);
subplot(2,2,4);
latlim4 = R4.LatitudeLimits;
lonlim4 = R4.LongitudeLimits;
worldmap(latlim4, lonlim4);
geoshow(grid_4,R4, "DisplayType", "surface");
demcmap(grid_4);
hold on
% second grid
subplot(2,2,3);
latlim3 = R3.LatitudeLimits;
lonlim3 = R3.LongitudeLimits;
worldmap(latlim3, lonlim3);
geoshow(grid_3,R3, "DisplayType", "surface");
demcmap(grid_3);
hold on
% third grid
subplot(2,2,1);
latlim2 = R2.LatitudeLimits;
lonlim2 = R2.LongitudeLimits;
worldmap(latlim2, lonlim2);
geoshow(grid_2,R2, "DisplayType", "surface");
demcmap(grid_2);
hold on
% fourth grid
subplot(2,2,2);
latlim1 = R1.LatitudeLimits;
lonlim1 = R1.LongitudeLimits;
worldmap(latlim1, lonlim1);
geoshow(grid_1,R1, "DisplayType", "surface");
demcmap(grid_1);
But they show up separated from each other with their own axes.
Does anyone have advice on how to plot all 4 of these as 1, larger, combined plot? dted, plotting MATLAB Answers — New Questions