Frame for 3-D map display






This map display is not a true map projection. Meridians, parallels, and displayed map data appear in 3-D view that depends on the view and camera settings of the map axes. Change the view interactively or by using the view function. Change the camera settings using the camposm, camtargm, and camupm functions.


In the 3-D sense, globe is true in scale, equal-area, conformal, minimum error, and equidistant everywhere.


The globe requires no standard parallels.


When displayed, the globe looks like an orthographic azimuthal projection, provided that the Projection property of the map axes is set to 'orthographic'.


expand all

Display geoid heights from the EGM96 geoid model over a 3-D globe. First, get geoid heights and a geographic postings reference object. Load coastline latitude and longitude data.

[N,R] = egm96geoid;
load coastlines

Create a frame for the 3-D globe display using axesm. Set the line of sight for the globe using view. Turn off the axes background using axis off. Then, display the geoid heights and coastline data.

axis off

Display a polygon on a globe by converting the polygon to a data grid.

Create a sample polygon that contains a hole and rests on the surface of the globe. To do this, generate the vertices of its external and internal boundaries using the outlinegeoquad function. Specify the geographic limits as the first two arguments, and the vertex spacing in degrees as the next two arguments. Reverse the order of the internal boundary vertices using the flip function, so they are in a counterclockwise order.

[latE,lonE] = outlinegeoquad([-35 35],[-30 30],0.25,0.25);
[latI,lonI] = outlinegeoquad([-15 15],[-15 15],0.25,0.25);
latI = flip(latI);
lonI = flip(lonI);

Combine the vertices into a single list by separating the boundaries with NaN values.

lat = [latE NaN latI];
lon = [lonE NaN lonI];

The vectors lat and lon represent the boundaries of a polygon that contain a hole. Display the boundaries on the globe as a filled polygon by converting the polygon to a data grid.

To do this, create a geographic cells reference object for the globe and a grid of ones. Replace elements of the grid with the polygon data using the vec2mtx function. The new grid contains 0s to indicate the inside region of the polygon, 1s to indicate the boundaries, and 2s to indicate the outside region of the polygon.

R = georefcells([-90 90],[-180 180],0.25,0.25);
V = ones(R.RasterSize);
[V,R] = vec2mtx(lat,lon,V,R,'filled');

Create a globe using the axesm function. Display the data grid as an image using the geoshow function. Adjust the colormap so the inside region of the polygon is purple and the outside region is white. Change the camera line of sight using the view function, so the polygon is displayed on the near side of the globe.

colormap([0.5 0.5 0.8; 0 0 0; 1 1 1])
axis off

The appearance of polygons on the globe is dependent on the camera line of sight and the globe transparency. For example, make the globe slightly transparent using the alpha function.


When you view the polygon from the near side of the globe, the external boundary vertices appear in a clockwise order. When you view the polygon from the far side of the globe, the external boundary vertices appear in a counterclockwise order. When you rotate the globe so the polygon appears on both the near side and far side, then the polygon appears to intersect itself.

Introduced before R2006a