Boolean Operations

Use the Grid and Image > Merge Grids > Boolean Operations menu option (GRIDBOOL GX) to combine or mask one grid with another, to create a new output grid.

Boolean Operations dialog options

Input grid file 1

Specify the first input grid.

Script Parameter: GRIDBOOL.GRD1

Input grid file 2

Specify the second input grid.

Script Parameter: GRIDBOOL.GRD2

Output grid

Specify the filename of the output grid to be created.

Script Parameter: GRIDBOOL.OUT

Boolean logic option

Define the Boolean operation used to combine the grids.

Default: AND

Script Parameter: GRIDBOOL.BOOL

Size of output grid

Specify the spatial extent of the output grid.

Default: Minimum

Script Parameter: GRIDBOOL.SIZ

Grid values used in overlap areas

Specify how values are assigned in regions where both grids contain valid data.

Default: Grid 1 Only

Script Parameter: GRIDBOOL.OLAP

Application Notes

Boolean Operations combine two input grids based on the presence or absence of valid data (non-dummy values) at each grid node. A dummy value represents a null or no-data cell in a grid.

The selected Boolean logic determines which regions are retained, while overlap and size options control how values are assigned and how the output extent is defined.

Boolean Logic Options

The .BOOL option can be "AND", "OR" , or "XOR" (Default = AND):

AND

The output grid is valid only where both grids contain valid data (the overlapping region).

OR

The output grid is valid wherever either grid contains valid data.

XOR

The output grid is set to dummy in regions where both grids overlap.

Output Grid Size Options

The .SIZ option can be "Minimum", "Same as Grid 1", "Same as Grid 2", or "Maximum" (Default = Minimum):

Minimum

The output grid covers only the overlapping valid region of both grids.

Same as Grid 1

The output grid matches the extent of input grid 1.

Same as Grid 2

The output grid matches the extent of input grid 2.

Maximum

The output grid spans the combined extent of both grids (full bounding area). Minimum coordinates are taken from the lowest values of both grids, and maximum coordinates from the highest values.

Overlap Value Options

The .OLAP option can be "Average", "Grid 1 only", or "Grid 2 only" (Default = Grid 1 only):

Average

Overlapping regions use the average of non-dummy values from both grids. If one value is dummy, the non-dummy value is used.

Grid 1 only

Values from grid 1 are used in overlapping regions.

Grid 2 only

Values from grid 2 are used in overlapping regions.

Typical Applications
  • Masking processed grids: Replace dummy values in a filled grid to match the valid area of an original grid (for example, as used by MAGMAP in the final processing step to remove filled areas from a processed grid).

  • Identifying overlap regions: Determine where two grids overlap.

  • Merging datasets: Combine overlapping grids into a single grid using averaging.

Handling Different Projections, Cell Sizes, Origins, and Offsets

The two input grids do not need to share the same projection, origin, or cell size. If differences are detected, the second grid is reprojected and interpolated to match the first grid.

In these cases, the output grid will always have origin coordinates that are integral multiples of the cell size in both X and Y.

If the origin of the first grid is not aligned to exact multiples of the cell size, it is also interpolated to the output grid before the Boolean operation.

If both grids share the same projection, cell size, and alignment (i.e., identical cell boundary offsets in X and Y), the original alignment is preserved. In this case, no re-interpolation or adjustment is required prior to the Boolean operation.