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

5 ビュー (過去 30 日間)
Leon
Leon 2015 年 4 月 26 日
コメント済み: Leon 2015 年 4 月 29 日
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.
  1 件のコメント
Leon
Leon 2015 年 4 月 29 日
Thank you very much for the help!

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by