# Calculate nDOM in PlexMap Switchboard

A normalized digital surface model (nDOM) describes the relative height of objects and results from the difference between a digital terrain model (DTM) and a digital surface model (DOM).

The following section describes how an nDOM can be generated in a Switchboard.

## Prepare raster data Anchor

The DOM and the DTM are first loaded into the PlexMap switchboard.

Then Coordinate Transformation is used to assign the coordinate system of your PlexMap instance to the two grids.

In order for the Grid Calculator function to run, the two input data must have the same resolution. This is achieved using the Resample function.

## Intersection of the raster data Anchor

In the further steps, the bounding boxes of the two grid datasets are first determined Bounding Box.

With Bounding Box as Polygon the determined bounding boxes are then converted into the data type Feature, since the function Intersection requires Feature as input.

With Intersection the exact intersection of the two surfaces is generated. The generated intersection is cut from the two grids (DTM and DOM) with Crop. Thus, two grids of the same size with the same resolution are calculated as preparation of Grid Calculator.

## Raster calculator Anchor

To calculate the nDOM with the Grid Calculator it should be noted that always the metadata of the first input grid is taken.

Under the parameter `expression`

mathematical functions and logical operators can be used.

Here the calculation rule : `(- (read 0) (read 1))`

is used. The DOM is read at input 0 and the DTM at input 1. Afterwards the DTM is subtracted from the DOM.

More examples and calculation rules for the grid calculator can be found here: Grid Calculator.

The optional parameter `type`

can be used to specify the data type of the result grid. If `type`

is not specified, the data type of the grid is taken at the first input.

To visualize the nDOM, it is colored using Colorize over a color ray loaded into the switchboard and then stored in a layer of type MapProxy.