How do I show land areas that have negative elevation

Technical Source
2 min readJan 17, 2022

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)?

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)

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

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:

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.