The Style pane can hill shade an image by interpreting the color values of pixels as heights. The system can then alter the display, darkening some pixels, to give the appearance of shadows as if the Sun were shining on a three dimensional surface. See the Style: Hill Shading topic.
This capability is used most frequently with raster data where the values of pixels represent terrain elevations, so the resulting impression of three dimensionality provides a realistic effect. Shading can also be used to generate distinctive visual effects in images where pixel values represent something other than terrain elevations. For example, if raster data shows temperatures in a given region, visualizing those temperatures as if they were hill shaded highs and lows can provide a more comprehensible display.
In this example we will use data where the value of each pixel represents the average elevation of the terrain in the region covered by the pixel.
We have imported raster data from a file that gives terrain elevations in a region of the state of Florida in the US. As with all raster data the data is kept as records in a table where each record contains a tile of data.
We double-click open the Florida Table component, which is the table with data that is visualized in the Florida image, to see what data type is used for pixels within the tiles.
Each record has a tile made of up 128 x 128 pixels, that is, 16384 pixels, with each pixel consisting of a single, float32 value.
In the illustration above we have right-clicked the column header
for the Tile field and chosen
Style, to change the format for
the Tile field from the default
format to a format that reports the size of the tile as well as the data type
of each channel and the number of channels.
Double-clicking on the map into which we previously have dropped the Florida image opens the map in a window.
The map has one layer in it, the Florida image. What we see initially is not all that impressive. It is an image composed of tones of black and very dark gray that are so similar to each other and all so dark it is difficult to make out any features. When importing terrain elevation data, Manifold will often present a very good image by default. We have deliberately chosen an example where the data is muddy and difficult to discern, so we can show how easy it is to create a more understandable display.
The problem with the display above is that contrast is poor, a typical situation in terrain elevation data where all of the elevations are similar. We are looking at a section of central Florida, an exceptionally flat region, where all of the elevations are a few meters, or feet, of each other. We can provide a better display by using the Style pane to increase contrast.
There are two ways to apply contrast to the image: a quick way to provide a visual impression that looks good, but is less useful in the long run, and a longer way that ultimately will be more useful with terrain elevation data.
In a few seconds with a few clicks we can provide a good visual impression with better contrast. We choose the Style pane.
The Style pane shows the R, G and B outputs used to form an image on our monitor and it tells us what data is used for each output. When a data set has only one numeric value per pixel that same numeric value is used to drive all three outputs. The pane shows how a single channel, Channel 0, is used to drive the R, the G and the B output.
When the same value is used for all three display outputs the result is a range of gray shades, from black when the value 0 is used for all three outputs to white when the value 255 appears in all three outputs. The 0 to 255 values are the possible range of values given the data type. That does not mean that within the image we will find pixels with all of those values, it just means that given the data type the values could range from 0 (black) to 255 (white) or numbers in between (various shades from very dark to almost white gray). Given that most of the altitudes in this region of Florida are well under 90 meters (the data set uses meters), the resulting tones are all in the zero to 90 range, from mostly near black to dark gray.
To automatically apply contrast, we Ctrl-click each of the rows to select them, and then we right-click into one of the 0 to 255 range boxes. We selected the three rows so that whatever we apply to one of them will apply to all three at once.
In the pull down menu that appears, we choose Autocontrast and then an autocontrast spread of 2.0 standard deviations, which usually works well.
The autocontrast computation resets the 0 to 255 range values for Channel 0 to the approximately 1 to 47 values which span two standard deviations. We press Update Style to apply the changes.
Immediately, we see an image with much better contrast. Numerous geographic features are now visible. The enhanced contrast is achieved by using pixel values within two standard deviations, a range from about 1 to 47 and stretching that range to fill the 0 to 255 range of available display intensities. Pixel values in the data set above 47 are forced to 255, that is, displayed as white and pixel values below 1 are forced to black.
What is wrong with the previous procedure is that we are pretending the image is an RGB image that is fed by three channels. That is a good approach sometimes for creating false color images, but usually treating the image for what it really is, a terrain elevation data set driven by a single channel, is a better approach. That allows us to use hill shading and palettes to color-code terrain elevations using discrete intervals of height, with a different color for each height interval.
Assume we start at the beginning with the Style pane as seen above.
Instead of using RGBA channels, in the pull down menu we choose Channel 0. The pane immediately switches to controls used with a single channel, basically a palette image.
Using equal intervals, we change the number of Breaks to 2 and we press the Tally button. We double-click into the color wells and set the upper color well to black and the lower color well to white. The Fill color will be remembered from our prior use of the pane. We make sure Fill is set to interpolate. With those settings we press the Update Style button.
That provides an immediately more understandable display, revealing the Lake Wales Ridge of higher territory that runs vertically down the central region of Florida. The highest location seen is Iron Mountain, near Lake Wales, not much of a "mountain" at only 90 meters above sea level, but it is dramatically higher than an otherwise very flat and low central Florida.
We can increase contrast even more by double-clicking into the lower value interval and changing the value to 47, thus forcing terrain values higher than that into the white interval. We press Update Style to apply the change.
Right away, the contrast increases.
Our next step is to apply hill shading. In the Options tab we check the Use shading box, an option which is only enabled if we are using a single channel. It is not enabled when using RGBA channels.
We use the default settings and press Update Options to apply shading.
The system immediately shades the terrain, as if was illuminated by a light source at a 45 degree azimuth elevation and placed at a compass bearing of 315 degrees. We are zoomed far out so the terrain is less crisp than when seen closer up. We can zoom in for more detail.
Zoomed in, we can see more details, and more detailed hill shading. In the illustration above we used a Z scale value of 1. For this particular data set that results in more emphatic shading effects. We can reduce the shading effect by using a lower Z scale value.
For example, we could change the Z scale value to 0.5 and then press Update Options.
That will produce a softer shading effect, because the shading will be computed as if the terrain were half as vertically high than with a Z scale of 1. We often will adjust Z scale in various data sets as we zoom in or zoom out to get exactly the effect we want.
We mentioned earlier that using a single channel was more productive in the long run for terrain elevation data, because a palette could be used. Let us now apply a palette.
We change the number of Breaks to 6 and then we press the Tally button. That computes intervals which are loaded with black color by default. To fill those intervals with a color palette, we click the Palette button.
In the palette button menus, we choose the Color Brewer CB Accent palette. If we are happy with this palette at this point we could just click the Update Style button and we are done. Easy!
However, from experience with this data set we know we would like to apply the CB Accent palette, but in reverse order. Doing that is easy. We click into the intervals pane to move the focus there and then we press Ctrl-A on the keyboard to select all of the intervals.
The intervals appear in red selection color to show they all have been selected. We right-click onto any of the color wells and choose Reverse from the context menu.
That reverses the order in which colors are applied. We press Update Style.
Instantly, Manifold applies the palette to the intervals specified, interpolating colors for pixel heights. We still have the Use shading option checked, so hill shading is applied as before. The result is a display that is colored by height of terrain and is also hill shaded.
In all the above it may look like pixel values have been modified but they have not. Only the display has been changed with computations necessary to show pixels as if they had different grayscale values done on the fly. The data in the table has not been modified. We could save the project, copy the saved project file to a USB drive, take it halfway around the world, open it on another machine and then by unchecking the options specified see the data is exactly the same as it originally was.
That is a very different situation than graphics editing packages such as PhotoShop, where if we change the contrast in an image the actual data in the image is changed. If we change the contrast of an image in PhotoShop, save it to a file and then send that file to someone else that other person could open it and see an image as edited by us, but they would have no way to know what the original file looked like. Many other GIS packages will also change the actual data if we make modifications such as changing contrast or altering pixel colors to give the appearance of hill shading. Manifold's ability to change contrast levels or to show hill shading in a display without changing the underlying data is an extremely useful capability.
To demonstrate that Manifold does not alter the underlying data but only changes the style of display, we will now use the Style pane to restore the display options back to their original form.
The quickest way to do that with this particular image is to choose (use RGBA channels) again.
We press Update Style.
The Style pane is in the starting state.
The image also is in the initial display. We have zoomed to fit.
Lake Wales Ridge - The data used shows the Lake Wales Ridge in Florida, which at a maximum height of 92 meters is one of the highest locations in central Florida.
Style: Channels and Outputs Tutorial
Example: How Images use Tiles from Tables - An example showing how an image is made up from data stored in a table in tiles.
Example: Create Two Images From One Table - More than one image can show data from the same table, including from the same tile field.
Example: An Image using Computed Fields in a Table - How an image can be created from tiles where the data for the tiles is taken from a field that is computed on the fly.
Example: Change the Contrast of an Image - In this example we use the Style pane to change the contrast of an image.
Example: Using the Assign Channels Button - The Assign Channels button in the Style pane for images allows us to assign channels to the standard three Red, Green, and Blue display outputs using frequently-desired arrangements. The button provides a short cut way to assign all channels at once instead of doing each channel individually.
Example: Set Image Transparency using Alpha - The A row in the Style pane allows us to specify what transparency we want to apply to the image, either by applying the same value for A for all pixels or by using one of the other channels to also control the A value. An example includes applying transparency to an imageserver image.
Example: Style Applied to an Image Server Image - Because the Style pane simply changes the way an image is displayed and not the data, it can operate on read-only data served by various web servers such as WMS REST servers. In this example we look at every detail of creating a data source using an image server and then manipulating the appearance of the display with Style. We will connect to a WMS server that provides LiDAR data in various forms, including as terrain elevation.