Geospatial Modelling Environment

reclassifyrecords (Reclassify Records / Features)

Issues a series of attribute selection statements to classify tabular records


This tool provides a mechanism for automatically issuing a series of selection statements, and populating a field with values based on those statements. The selection statements are formulated in exactly the same way as in the 'Select by attributes' tool in ArcMap (SQL-style statements based on field names and values). The benefit of this command is that a set of selection statements can be issued automatically, a field can be automatically populated with values, and this procedure can be conveniently applied to many datasets.

The input is a table or feature data source, and the output is stored in a new or existing field. By default the output field type is the long integer type and the recode values must therefore be integers. However, you can change this to either double or string field types to accomodate other recode values (real numbers or text respectively). If you specify an existing field you must also authorize the tool to overwrite data in this field using the 'update=TRUE' option.

The selection statements are stored in a separate text file (e.g. one that you have created with Notepad). This text file should have no header line, and should have one statement per line. The syntax of the selection statement is exactly as it would appear in the 'Select by attributes' tool in ArcMap. An R style assignment operator (->) is used to define what value is assigned to the records that are selected by a statement. For instance, given a field name called PrSuitHab, which contains real numbers ranging from 0-1, the following three lines would result in all records being classified as either 1, 2 or 3.

"PrSuitHab" <= 0.2 -> 1

"PrSuitHab" > 0.2 AND "PrSuitHab" <= 0.7 -> 2

"PrSuitHab" > 0.7 AND "PrSuitHab" <= 1 -> 3

If you have specified a string output field then you must specify the recode value using double quotes:

"PrSuitHab" <= 0.2 -> "A"


reclassifyrecords(in, file, field, [fieldtype], [update]);

inthe input table or feature data source
filethe file containing the reclassification instructions - see the full help documentation for details
fieldthe new field that will contain the reclassification values
[fieldtype]the field data type - short integer, long integer, double precision real number, or string (options: SHORT, LONG, DOUBLE, STRING)
[update](TRUE/FALSE) if TRUE and you specify an existing field, the existing field will be updated rather than generating an error message (default=FALSE); warning: this option will result in overwriting of existing data and is therefore potentially dangerous.


reclassifyrecords(in="C:\data\landcov", file="C:\data\lcrecode1.csv", out="C:\data\newlc");

reclassifyrecords(in="C:\data\dem.img", file="C:\data\recodedem.csv", out="C:\data\elev");


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

Tips on how to use this interface efficiently 


Open Source GIS

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