Mapping toolkit: problems plotting near the pole
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm using the mapping toolkit to display some data near the north poles, and I noticed that many of MATLAB's mapping functions break down near the poles.
As a demonstration, consider patchm. If the polygon goes over the north pole, it will fill outside of the polygon, rather than inside of the polygon. Here's an example where you can see that patchm correctly fills in Antarctica when it's at the south pole, but fills outside of Antarctica if Antarctica is at the north pole.
The issue is very noticeable for patchm, but I've also noticed it for other functions (e.g., isinterior). I can implement improvised solutions to mitigate these things—like rotating the reference frame to do the calculations away from the poles—but I'd love if someone has a simpler solution.
load coastlines
figure(1);clf;
subplot(1,2,1); % Antarctica on the south pole
axesm sinusoid; framem; axis tight;
patchm(coastlat,coastlon,'b');
subplot(1,2,2); % Antarctica on the north pole (by flipping the latitude)
axesm sinusoid; framem; axis tight;
patchm(-coastlat,coastlon,'b');
0 comentarios
Respuestas (1)
Kevin Holly
el 25 de Abr. de 2024
James,
I reported the issue and obtained the following workaround:
load coastlines
% Invert the orientation of the line demarcating Antarctica’s coast
antarcticaLat = coastlat(1:612);
antarcticaLon = coastlon(1:612);
[newAntarcticaLon,newAntarcticaLat] = poly2ccw(antarcticaLon,antarcticaLat);
newcoastlat = [newAntarcticaLat; coastlat(613:end)];
newcoastlon = [newAntarcticaLon; coastlon(613:end)];
figure(1);clf;
subplot(1,2,1); % Antarctica on the south pole
axesm sinusoid; framem; axis tight;
patchm(coastlat,coastlon,'b');
subplot(1,2,2); % Antarctica on the north pole (by flipping the latitude)
axesm sinusoid; framem; axis tight;
patchm(-newcoastlat,newcoastlon,'b');
0 comentarios
Ver también
Categorías
Más información sobre Map Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!