How do I show land areas that have negative elevation in a map as green using the function DEMCMAP in the Mapping Toolbox 3.2 (R2010b)?

6 views (last 30 days)
I am using HDR and elevation files for a tile that has land areas below sea level. That is, some land areas in this tile have elevations less that zero.
This negative elevation land area is currently appearing as blue.
Reproduction Steps:
Lets assume that the tile "a" has land areas with negative elevations in your current folder.
% read globe file
[z,rv]=globedem('a',10);
% plot globe file
figure;
worldmap(z,rv)
geoshow(z,rv,'DisplayType','texturemap');
demcmap(z)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Apr 2016
It is not possible to use the function DEMCMAP for displaying land areas with negative elevations with a different colormap than that used for water.
As a workaround, you can use the attached wrapper function "colordem" that will allow water to display as blue (or whatever color is desired) and land areas below zero to be displayed with a distinct color scheme. COLORDEM essentially concatenates a separate color map to the existing map for land areas below zero.
For the approach below to work, it is necessary that areas containing water have elevation values of NAN.
The "minZ" and "maxZ" inputs to the function COLORDEM can be used to create a common mapping of terrain elevation to color for multiple maps with different content.
The finally modified code with the above COLORDEM function will look as follows:
[z,rv]=globedem('a',10);
figure;
worldmap(z,rv)
geoshow(z,rv,'DisplayType','texturemap');
colorbar
% Adapt to the specific data grid.
minZ = min(z(:));
maxZ = max(z(:));
elevationInc = 10;
belowSeaLevelCMap = @gray;
oceanColor = [0 0 1];
colordem(minZ, maxZ, elevationInc, belowSeaLevelCMap, oceanColor)

More Answers (0)

Products


Release

R2010b

Community Treasure Hunt

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

Start Hunting!