Name

PolyGrid — Rasterize a polygon file

Synopsis

Synopsis

ca.spatial.gis.vector.PolyGrid {input} {cellSize} {item}

ca.spatial.gis.vector.PolyGrid {input} ncols} {nrows} {xllcorner} {yllcorner} {cellSize} {item}
      

Arguments

NameTypeDefault
inputthe name of the input coverage or shape fileNone
cellSizethe length of edge of the cells used to grid the coverageNone
itemthe column name of he cells used to grid the coverage None
ncolsthe number of columns to rasterizeNone
nrowsthe number of rows to rasterizeNone
xllcornerthe x-coordinate of the lower left corner of the grid None
yllcorner the y-coordinate of the lower left corner of the grid None

Description

The polygrid command will rasterize a polygon coverage or shapefile. Each raster cell will be labeled with a value according to the selected labeling item. The results of the rasterization process will be written out into an ESRI ASCII format grid file.

There are two invocation options. The first option is to provide only the cell size to be used for gridding. Using this option, the program will automatically compute the lower left starting coordinate, and the number of rows and columns to make up the grid. The lower left coordinate will be rounded off to an even multiple of the cell size. The number of rows and columns will be adjusted so that the raster completely covers the input file.

The other processing option is to explicitly specify the starting point and the number of rows and columns to be used in the grid. You may use this option to specify only a portion of the input file is rasterized, or to match the sampling raster to another coverage.

Processing Notes

A special item name of "$recno" may be used to label each raster cell with the record number of the polygon of interest.

The raster is sampled at the centers of the imaginary grid that is projected on to the input file.

Small polygons that do not intersect with the imaginary grid will not be sampled.

See Also

GridASCII

Examples

java -jar patchworks.jar ca.spatial.gis.vector.PolyGrid gamme3.shp 10 \
     GRIDCODE grid.asc
    

This command will create an output file name "grid.asc". The input file will be rasterized using a 10m grid size. The starting point and number of rows and columns will be automatically dtermined in order to completely cover the input file. The grid cells will be labeled with the contents of the "GRIDCODE" column.

java -jar patchworks.jar ca.spatial.gis.vector.PolyGrid gamma3.shp 100 100 \
     662000 5500000 50 GRIDCODE grid50.asc
    

This command will create an output file named "grid50.asc". The input file will be rasterized using a 50m grid. The starting point and number of rows and columns have been explicitly stated. The grid cells will be labeled with the contents of the "GRIDCODE" column.