English

How To: Create a grid with centroid values as the coordinates, without using GRID

Summary

This document describes how to create a grid where the values are the x and y coordinates of the cell centroids defined with ADDXY.

No Grid license is necessary to perform these steps.

Procedure

  1. Convert the grid to a point coverage.

    Code:
    GRIDPOINT in_grd outcov

    The points will be created at the centroids of the grid cells.
  2. Build topology for points.

    Code:
    BUILD outcov POINT

    This will create a point attribute table.
  3. Add new items X-COORD and Y-COORD to the point attribute table.

    Code:
    ADDITEM pnt.pat pnt.pat x-coord 8 25 F 12
    ADDITEM outcov.pat outcov.pat y-coord 8 25 f 12

    The default number of decimal places created by ADDXY in the next step is 5. Greater precision is gained by manually creating the coordinate items.
  4. Add the coordinates of the centroid point to the items X-COORD and Y-COORD of the point attribute table.

    Code:
    ADDXY outcov POINT

  5. Use the POINTGRID command to create the final grid.

    Code:
    POINTGRID outcov grdx x-coord
    Cells size (square cell): &DESCRIBE in_grd
    : %GRD$DX%
    Convert the entire coverage(y/n)? y
    Enter background value:

    POINTGRID outcov grdy y-coord
    Cells size (square cell): &DESCRIBE in_grd
    : %GRD$DX%
    Convert the entire coverage(y/n)? y
    Enter background value:

    To insure that the cell resolution of the final grid matches that of the original grid, the &DESCRIBE directive is used to obtain the full precision from the reserved AML variables for grids.

Related Information