GME

Geospatial Modelling Environment

field.find (Find Mininum/Maximum Among Fields)

Searches fields to find the minimum and/or maximum value in each record

Description

This tool searches a collection of fields to find the minimum and/or maximum value among those fields, and writes the result of the search to a new field. In the case of a tie, the tool reports the first field encountered with the minimum or maximum value.

The input fields can be specified either as a vector of field names (see example below) or providing the prefix of field names that will be used in the search. For instance, using the isectpolyrst tool with the thematic option to summarize a categorical raster dataset can produce numerous fields that share the same prefix. This prefix option is therefore convenient for searching this sort of data to find, for instance, the dominant land cover type in each polygon.

The data written to new field is based on the field name of the field that met the search criteria. By default it is the field name of the field that met the minimum or maximum criteria. However, you can also use a 'remove' option to specify the number of characters that are removed from the beginning of the field name before writing to the output. Thus, if I want to record the dominant land cover code, and all by fields begin with the prefix 'LCV', then setting remove=3 would strip the prefix and write only the landcover value itself.

In general, if you are working with inconsistently named fields you will provide the field names as a vector, and write the output as a string with no 'remove' option. If you are working with consistently named fields you will typically specify the prefix of the fields, set the remove option to the length of the prefix, and write the output as an integer or string as appropriate.

Note that the field.rename tool is useful here to rename any fields that do not conform to an otherwise consistent naming convention.

Syntax

field.find(in, fields, [max], [outmax], [min], [outmin], [type], [remove]);

inthe input table or feature data source
fieldslist of field names as an array, or a single string with the prefix of all fields to include in the search
[max](TRUE/FALSE) if TRUE, finds the field with the maximum value among the fields specified (default=TRUE)
[outmax]if max=TRUE, the name of the maximum output field to create
[min](TRUE/FALSE) if TRUE, finds the field with the minimum value among the fields specified (default=FALSE)
[outmin]if min=TRUE, the name of the minimum output field to create
[type]the output field type, options: STRING (default), LONG (long integer), DOUBLE (double precision real number)
[remove]an integer representing the number of characters to remove from the beginning of the field name before writing it to the output field (default=0)

Example

field.find(in="C:\data\plots.shp", fields=c("LCV1", "LCV2", "LCV5", "LCV99"), max=TRUE, outmax="DOMINVAL");

field.find(in="C:\data\plots.shp", fields="LCV", max=TRUE, outmax="DOMINVAL", min=TRUE, outmin="MINVALFLD", type="LONG", remove=3);


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