GME

Geospatial Modelling Environment

genvecgrid (Generate Vector Grid)

Generates a vector grid (a series of regularly sized and spaced square/rectangular polygons)

Description

This tool generates a 'vector grid': a series of regularly sized and spaced square or rectangular polygons, lines or points. The extent of the vector grid can be specified by referencing a feature data source (from which the extent of the dataset is extracted), or by directly specifying the minimum and maximum x and y coordinates. The user also specifies the dimensions of the vector cells (which can be square or rectangular). The tool then fills the extent with cells of this size.

Note that if the output geometry is polygons and the vector cell size does not result in an exact fill of a row or column then the tool will always extend slightly beyond the defined extent to ensure all space is filled, rather than leave some space within the extent unfilled. Thus the extent of the output dataset may not match the extent you specified, but all space within the specified extent is filled.

There is an option to only keep the vector cells that overlap with the features in another layer. This can be particularly useful for generating sampling grids where sample plots are only needed/allowed in places where there is something to sample. Note that using this option can result in considerably longer processing times, especially if there are large numbers of features in the layer you specify for the overlap test.

The snap option forces the spatial position of the grid to be aligned with the underlying coordinate system. For instance, specifying snap=1000 would force the vector grid lines to be aligned with the exact 1km positions in a UTM grid.

The line geometry option results in what are effectively graticule lines. The point geometry option generates a grid of points, with the additional option that alternate rows can be offset (resulting in a honeycomb pattern rather than a chessboard pattern).

Syntax

genvecgrid(extent, dim, out, [geometry], [snap], [testoverlap], [offset]);

extentthe reference layer that defines the extent of the vector grid, or a set of four values that define the extent (min x, max x, min y, max y)
dimthe dimensions of each vector grid cell (either a single value representing the cell width and height, or two values representing the width and height respectively if they are not the same dimension)
outthe output feature data source
[geometry]the type of output geometry (default=POLYGON, options: POINT, LINE, POLYGON)
[snap]a value > 0; controls whether the vector grid is aligned with a major coordinate system interval (supplying a value of 1000 will result in the grid being aligned to the 1000-mark intervals of the coordinate system); default=0 (no snap)
[testoverlap]only vector grid cells that overlap features in this feature data source will be retained
[offset](TRUE/FALSE; only applies to the geometry="POINT" option) offsets alternate rows of points by half of the x spacing (default=FALSE)"

Example

genvecgrid(extent=c(100000, 220000, 2000000, 2300000), dim=c(1000, 2000), out="myoutput.shp");

genvecgrid(extent="C:\data\referencelayer.shp", dim=1000, out="myoutput.shp", geometry="LINE", snap=100, testoverlap="C:\data\roads.shp");

genvecgrid(extent="C:\data\locs.shp", dim=c(0.05,0.1), out="myoutput.shp", snap=0.1, usesel=TRUE, testoverlap="C:\data\rivers.shp");

genvecgrid(extent="C:\data\county.shp", dim=1000, out="pntgrid.shp", geometry="POINT", offset=TRUE);


Messages

Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently  Read more...

Links

Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn