How to create a mask on a map in lat-lon coordinates?

11 views (last 30 days)
I want to produce a mask on the region shown in figure (map_mask.fig).
I have a lon x lat grid of size 1440x121.
It represents the northen hemisphere with latitude [60,90]N and longitude [-180,180]W at 1/4 degree resolution.
I tried to use poly2mask with the freehand object I wanted as a mask. I got an empty matrix with only 0s.
%Load var: latitude, longitude, latMat, lonMat
%unsuccessful attempt
roi = drawfreehand;
Mask = poly2mask(roi.Position(:,1),roi.Position(:,2),1440,121);
%Plot domain
hold on;
axesm('MapProjection','eqdazim','MapLatLimit',[60 90]);
axis off;
framem on;
gridm on;
mlabel on;
plabel on;
axis off;
Thank you

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by