# Grid Creation

Data can often be collected in varying densities and spatial patterns.  It can then be used as a point database, a TIN, or converted to a grid.  The following mechanisms can be used for the creation of the grid: • Drop in the bucket.  The figure above shows a grid in the solid lines, and we want the value at each line intersection.  The dotted lines divide the region into blocks, and each block is closest to a single intersection of the grid.  For example, the red box outlines the region that is closest to the green grid point.  In the simplest drop in the bucket algorithm, each collected point is assigned to the nearest grid intersection.  There is no attempt to assign weights by where in the box the point occurs.  If there are more than one point in the box, either the first or the last can be selected.  To select the first, a check must be made that the point is not missing, and the new value is only assigned if the point is missing.  To select the last, points are processed and later points can simply overwrite previous ones.  With additional care in designing the algorithm, drop in the bucket  can pick the median or mean.  There is no consideration of where the data points occur with respect to the intersection location.
• Highest point: create a DSM, or the ceiling
• Lowest point: create a DTM, or the floor In some cases with a rectangle, there can be two ways to draw the contours, as in the case on the left.  On the left, a ridge connects the two points with elevation of 80, and on the right, a valley connects the two points with elevation 70.  The number of such boxes will generally be small, and with a large DEM, the effect will also be very small.

• TIN: since three points determine a plane, this provides unambiguous placement for contour lines (in some cases with a rectangle, there can be two ways to draw the contours, as in the example above).  Computer graphics also likes triangles: it is easy to computer the normal to the surface, and hence the lighting; high end graphics cards measure their speed in triangles per second.

Additional algorithms not used in MICRODEM for grid creation.

• Distance or inverse distance weighting.  This algorithm finds the nearest neighbors.  Variants require a specific number of points, or points in various directions, say one in each of the four principle directions or eight directions.  The values are weighted by distance, and can use a linear, squared, or other weighting to apply greater weights to points close to the grid intersection.
• Trend surface: in this algorithm, a number of points surrounding the grid intersection are selected.  A surface is fit to the points, and the value of the trend surface at the grid intersection is taken as the value for the grid.
• Kriging or geostatistics: this was designed by the mining industry, and rests on the assumption that you can find a relationship about how values of the surface change with distance.  More complex versions can account for anisotropy, that values change faster in some directions than others.  You must first create a variogram, which will have a nugget and a range out to which you can infer relationships.

Last revision 2/15/2017