Window a Grid using a Polygon File

Use the Grid and Image > Window a Grid using Polygon File (GRIDMASK GX) option to mask a grid using coordinates defined in a polygon (PLY) file. The polygon coordinates are interpreted in the coordinate system of the input grid. Depending on the selected option, areas of the grid inside or outside the polygon are masked (i.e., replaced with dummy values).

Window a Grid using Polygon File dialog options

Input grid file

Select the input grid (.grd file).

Script Parameter: GRIDMASK.GRDIN

Output masked grid file

Specify the name for the output masked grid (.grd file).

Script Parameter: GRIDMASK.GRDOUT

Polygon coordinates file

Select the polygon (PLY) file containing the mask geometry. The file may contain one or more polygons.

Script Parameter: GRIDMASK.POLY

Mask the area OUTSIDE or INSIDE the polygon

Choose whether to replace values inside or outside the polygon with dummy values.

Script Parameter: GRIDMASK.MASKOPT

Clip output grid to polygon boundary?

Specify whether the output grid extent is reduced.

  • Select Yes to clip the output grid so that its spatial extent matches the bounding box of the polygon.

  • Select No to retain the full spatial extent of the input grid. Grid cells inside or outside the polygon (depending on the mask option) are set to dummy values, but grid dimensions remain unchanged.

The output grid cell size (resolution) is identical to the input grid cell size.

Script Parameter: GRIDMASK.RESIZE

Application Notes

Use this GX to replace grid values inside or outside a defined polygon with dummy values. Dummied areas are displayed as blank (white) space when the grid is rendered.

The masking polygon may be defined in either a clockwise or counter-clockwise sense, and it may contain up to 2048 vertices. There may be more than one polygon defined in a polygon file. The masking process is applied to all polygons defined in the file.

Edge Behavior

  • Mask OUTSIDE: grid nodes on the polygon boundary are retained (not masked).

  • Mask INSIDE: grid nodes on the polygon boundary are masked (set to dummy values).

Dummy Values

When Clip output grid to polygon boundary? is set to No, the output grid retains the full spatial extent of the input grid.

Cells inside or outside the polygon are set to dummy values and appear as blank (white) regions when displayed. This is expected behavior and does not indicate missing or corrupt data.

Example:

This example uses MASK.PLY to mask the grid TST.GRD. With the mask option set to OUTSIDE, all regions outside the polygon are replaced with dummy values, producing the output grid MTST.GRD.

To mask a simple rectangular area, the file MASK.PLY might contain coordinates such as:

435, 300

520, 300

520, 550

435, 550

The polygon is automatically closed by connecting the final vertex to the first.