I am using QGIS 2.12 on a Macbook Pro running OS X 10.10.5.

I have an interesting DEM for the California coast (which I downloaded from Santa Barbara, CA 1/3 arc-second MHW DEM.

I've been playing with color ramps for this. How can I get the colors to change smoothly yet still break from blues to greens exactly at sea level (elevation zero)?

The only way I have succeeded in getting a precise break at the shoreline (sea level) is to have discrete color changes. But that does not look good at all in areas away from the shoreline.

2 Answers 2


There is several ways you can accomplish this. I would start playing with the min / max value and number of classes in equal mode to see if you can get a match for you need. You can also do it manually editing the value and color directly in the color band scale. The plus and minus button can add classes manually.

enter image description here


I came here because I had the same problem. After a while of "playing around" as suggested in the other answer, it dawned on me that having both a smooth gradient and a hard cut at 0 is difficult to achieve this way. There is an easy solution, however, if you don't mind cheating a bit.

The easiest way to accomplish this is probably to duplicate your DEM layer: Have one layer for everything below sea level and another one for everything above. That way you can have both smooth gradients for below and above sea level and a sharp cut between them easily:

The lower bathymetry layer gets a gradient of blues from e.g. -50m to 0m.

enter image description here

The upper topography layer gets a gradient of greens from e.g. 0 to whatever you highest mountain has. The trick then is to make everything below 0 transparent for this layer, so that the blues of the bathymetry layer below can shine through (this is the only "manual" edit you have to do with this).

enter image description here

I'll probably look for some nicer looking gradients, but in principle this works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.