This tool can be used to convert a vector points file (shapefile) into a raster grid. The user must specify the name of the input shapefile and the output raster file. The 'Field Name' is the field from the attributes table, i.e. DBF file, from which the tool will retrieve the information to assign to grid cells in the output raster. Note that if this field contains numerical data with no decimals, the output raster data type will be INTEGER; if it contains decimals it will be of a FLOAT data type. The field must contain numerical data. If the user does not supply a Field Name parameter, each feature in the raster will be assigned the record number of the feature. The assignment operation determines how the situation of multiple points contained within the same grid cell is handled. The background value is the value that is assigned to grid cells in the output raster that do not correspond to the location of any points in the input vector. This value can be any numerical value (e.g. 0) or the string 'NoData', which is the default.
If the user optionally specifies the Cell Size parameter then the coordinates will be determined by the input vector (i.e. the bounding box) and the specified Cell Size. This will also determine the number of rows and columns in the output raster. If the user instead specifies the optional Base Raster File parameter, the output raster's coordinates (i.e. north, south, east, west) and row and column count will be the same as the base file. If the user does not specify either of these two optional parameters, the tool will determine the cell size automatically as the maximum of the north-south extent (determined from the shapefile's bounding box) or the east-west extent divided by 500.
The following is an example of a Python script that uses this tool:
wd = pluginHost.getWorkingDirectory()
inputFile = wd + "input.shp"
outputFile = wd + "output.dep"
fieldName = "INCOME"
assignement = "minimum"
backgroundVal = "NoData"
cellSize = "10.0"
baseFile = "not specified"
args = [inputFile, outputFile, fieldName, assignment, backgroundVal, cellSize, baseFile]
pluginHost.runPlugin("VectorPointsToRaster", args, False)
This is a Groovy script also using this tool:
def wd = pluginHost.getWorkingDirectory()
def inputFile = wd + "input.shp"
def outputFile = wd + "output.dep"
def fieldName = "not specified"
def assignement = "first"
def backgroundVal = "0.0"
def cellSize = "not specified"
def baseFile = wd + "base.dep"
String args = [inputFile, outputFile, fieldName, assignment, backgroundVal, cellSize, baseFile]
pluginHost.runPlugin("VectorPointsToRaster", args, false)