How to shift a map, so that the Pacific Ocean will be in the center?

4 次查看(过去 30 天)
I'm using the below commands to plot a global map.
S1 = shaperead('map/ne_110m_land.shp');
mapshow(S1);
How do I shift the map slightly, so that the Pacific Ocean will be displayed in one piece? When I used plot(x,y, 'k.') to do the plot, I can simply use x(x<20)=x(x<20)+360 to deal with it. How should I do it in mapshow?
Thank you.

采纳的回答

Philip Caplan
Philip Caplan 2015-4-27
Here is an example of how to shift the x-coordinates of all the geometries stored in the 'concord_roads.shp':
S1 = shaperead('concord_roads.shp');
S2 = S1;
for i=1:length(S2)
S2(i).X = S2(i).X +1e5; % replace appropriate shift here
end
figure(1); mapshow(S1);
figure(2); mapshow(S2);
You will notice that the x-coordinates in Figure 2 are all shifted by 1e5.
You may not need to apply this shift to all the geometries stored in the structure returned by shaperead so you may only need to apply this shift to a certain subset of the geometries describing the Pacific Ocean.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by