Grid From Expression creates a Grid item from an expression involving other named Grid items. This operation is sometimes called Grid Analysis.
The Grid is used to depict a Digital Terrain Model (DTM) or the density of point data within cells of a given size, it is displayed as a raster image, and uses colours shades to indicate density or other properties, as defined in a Colourset.
Before using this command, you must save other Grid items in a Named Object Library, using Store Item [Create-Miscellaneous]. (There are other ways to create Grid items, such as Scatter Grid [Analysis-Grids] and From QZone [Analysis-Grids].)
The syntax requires the use of the FindGrid() function:
For example, if you have already saved two Grid items, called g1 and g2, then you can create a third Grid item using any of the following expressions:
In each case, SIS will create the new Grid by applying the expression to the values in overlapping cells. If the two original Grid items have different cell sizes, then SIS will resample one of them to match the other.
Further examples of the use of the FindGrid() function:
Grids may be stored in subfolders in a NOL.
If for example grids are stored in New Grids, Old Grids and Archived Grids folders and subfolders:
The name of a grid in a folder in a NOL is in the form "Folder.Grid" or "Folder.SubFolder.Grid", etc.
If you want to target a specific NOL file, use FindGrid("LibName\\Folder.Grid").
The following example will add the G5 grid in the New Grids folder to the GridA grid in the Old Grids.Archived Grids folder.
FindGrid("New Grids.G5")+FindGrid("Old Grids.Archived Grids.GridA")
For example If there were two grid items called Density and Height stored in your current library, two possible expressions might be:
FindGrid("Density")*2+FindGrid("Height")*3
The above expression results in a grid of 2 times the cell value of the Density grid, plus three times the cell value of the Height grid
FindGrid("Height")*FindGrid(max("Density","1"))
The above expression results in the cell value of the Height grid being multiplied by the larger of either the Density cell values or 1.
Applying the expression to the values in overlapping cells creates the new grid. If the two original grids have different cell sizes, one of them is resampled so that it matches the other.
If you use an expression that includes division, be careful to avoid dividing by zero. For example, you might be dividing a grid containing a sum of values in each cell by a second grid containing the count of points in each cell, in order to produce a third grid containing average values in the cells. You might encounter problems if some of the cells in the second grid are empty - this would involve division by zero. To avoid this problem, use an expression such as:
FindGrid("g1")/FindGrid(max("g2","1"))
This ensures that whenever the count of points is zero, the grid (g1) will be divided by 1, not zero.
Top of page
Click to return to www.cadcorp.com
© Copyright 2000-2017 Computer Aided Development Corporation Limited (Cadcorp).