How to shift a map, so that the Pacific Ocean will be in the center?
7 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Philip Caplan
on 27 Apr 2015
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.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!