How to plot Earth and drape a mesh with elevation data over it?

E
Emmitt · Oct 28, 2020 · 1.9K views
Question
Hello, I need a simple Earth model, but with correct elevation data. With it I want to check whether visual contact between two points is possible. (i.e. is there a mountain in view or not?) With the help of the documentation I created this code: Earth = wgs84Ellipsoid; figure('Renderer','opengl') ax = axesm('globe','Geoid',Earth,'Grid','off'); axis equal off view(3) load topo geoshow(topo,topolegend,'DisplayType','texturemap') demcmap(topo) land = shaperead('landareas','UseGeoCoords',true); plotm([land.Lat],[land.Lon],'Color','black') I got the hint with meshm from this example: load geoid meshm(geoid,geoidrefvec,size(geoid),topo) However, adding these two lines seems to be not enough. I do not get errors, but the coloring is weird. Question: How can I drape the elevation data over an ellipsoid? And is there a easy way to check whether a line between two points is intersecting the mesh or not?
Expert Answer
Profile picture of Neeta Dsouza
Neeta Dsouza PhD Expert
Answered Aug 25, 2026

Dear future reader, this is the solution I found:

Earth = wgs84Ellipsoid;
axesm('globe','Grid','on','GlineStyle','-','Geoid',Earth)
view(3)
axis off

load topo

topo = topo / (1e-2); % The elevation can be exaggerated here 
meshm(topo,topolegend,size(topo),topo);
demcmap(topo)
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!