Globe display issue - need opaque sub-surface

2 views (last 30 days)
CAC
CAC on 14 Nov 2018
Answered: Chad Greene on 8 Mar 2019
I'm trying to plot data on a 3D globe with the Mapping Toolbox, and I've encountered the following issue.
When plotting on another map projection like 'ortho,' I can turn on the frame and set its color, and then overlay shapes like the following:
axesm('MapProjection','ortho','Frame','on','Grid','on','FFaceColor',...
[190 208 233]/255,'MeridianLabel','off','ParallelLabel','off','Geoid',...
referenceEllipsoid('wgs84'),'Origin',[0,0,0])
land = shaperead('landareas','UseGeoCoords',true);
geoshow(land,'FaceColor',[245 237 220]/255)
tightmap
I want to do this for a 3D globe, but it seems that since 'globe' is not an actual map projection, it doesn't have a frame for which I can set a background color. Thus, when I overlay my data, you can see right through the globe in between the shapes:
axesm('globe','Frame','on','Grid','on','FFaceColor',[190 208 233]/255,...
'MeridianLabel','off','ParallelLabel','off','Geoid',...
referenceEllipsoid('wgs84'))
land = shaperead('landareas.shp','UseGeoCoords',true);
geoshow(land,'FaceColor',[245 237 220]/255)
view(3)
How can I add an opaque background layer to a globe?

Answers (1)

Chad Greene
Chad Greene on 8 Mar 2019
For the globe functions in the Climate Data Toolbox for Matlab I had to include one called globefill, for that very purpose. If you want to stick the Mapping Toolbox functions, you might be able to plot a regular white sphere like this:
[X,Y,Z] = sphere(N);
h = surf(X*radius,Y*radius,Z*radius,'facecolor',color,'edgecolor','none');
To determine the radius, plot the globe as you have already done, then type xlim or ylim to get the limits of the axes. I don't have Matlab with me right now, but I'm guessing it will be in the range of 0.5 or something. Tinker with the value of the radius until you get a white sphere inside the globe, not too big, and not too small.

Community Treasure Hunt

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

Start Hunting!