![]() Reserved Words in LEGALThis page presents the syntax of commands and some reserved words in LEGAL.
OBS: The reserved words are shown in bold.
Declaration1 - ImageIt declares a variable of Image type that will be later associated to the current IL or to a new one created in the program. This variable can be used in any program operation. Syntax: Image variable ("category"); Considerations The first term indicates that the Image geo-fields can be associated to the variable during the program execution. The category between quotes and parenthesis denotes the category defined in the active database. More than one variable name can be declared for the same category. Examples:
2 - NumericIt declares a Numeric (or digital) variable that will be later associated to the current IL or to a new one created in the program. This variable can be used in any program operation. Syntax
Considerations The first term indicates that the Numeric geo-fields can be associated to the variable during the program execution. The category between quotes and parenthesis denotes the category defined in the active database. More than one variable name can be declared for the same category. Example:
3 - ThematicIt declares a Thematic variable that will be later associated to the current IL or to a new one created in the program. This variable can be used in any program operation. Syntax:
Considerations The first term indicates that the Thematic geo-fields can be associated to the variable during the program execution. The category between quotes and parenthesis denotes the category defined in the active database. More than one variable name can be declared for the same category. Examples:
4 - ObjectIt declares an Object variable that will be later used in an operation such as reclassification by attributes. Syntax:
Considerations: The first term indicates that the object entities can be associated to the variable during the program execution. The category between quotes and parenthesis denotes the category defined in the active database. More than one variable name can be declared for the same category. Example:
5 - CadastralIt declares a Cadastral variable that will be later associated to the current IL or to a new one created in the program. Syntax
Considerations: The first term indicates that the cadastral entities can be associated to the variable during the program execution. The category between quotes and parenthesis denotes the category defined in the active database. More than one variable name can be declared for the same category. Examples:
6 - TableIt declares a table variable that will be used to define transformations between fields and objects of different types. Syntax Table variable (transformation_type); Considerations When we declare a table, the first term must contain the reserved word Table followed by the variable name and a key word indicating the type of transformation: Reclassification, Slicing or Weighting. More than one variable name can be declared for the same transformation. A Reclassification table defines the mapping between thematic classes of two different categories. In the Slicing, a field of a numeric category is transformed in a thematic field, while in a Weighting the transformation is from a thematic field to a numeric one. Examples:
7 - AttributeObjects Attributes do not need to be explicitly declared. It is enough to directly refer to it (in capital letters) between quotes along with the object variable, following the syntax:
Considerations: The object category name to which the attribute belongs to must be previously associated to the object_variable. Instantiation1 - RetrieveIt associates an information layer existent on the current project to a previously declared variable. Syntax:
Considerations: The Retrieve operator deals with the following operators: Image, Numeric, Thematic, Objects and Cadastral. The retrieved variable and information layer must be the same type. When the information layer is of the vector type, the optional parameter Repres must be informed. Examples: // Declarations Examples
// Instantiation Examples
2 - NewWhen it is used with Thematic, Image or Numeric variables, it creates an information layer of the same type on the current project and associates this layer to the left side of the assignment sign "=". When it is used with Table variables, the New operator creates a table on the context of the executing program. This table can be used on the procedures that are based on tables.
Parameters:
Examples: // Creating an Image IL:
// Creating a Thematic IL:
// Creating a Numeric IL:
// Creating a Cadastral IL:
// Creating a Weighting Table:
// Creating a Slicing Table:
// Creating a Reclassification Table:
OperationAssignIt generates a thematic information layer by mapping a geoclasss based on the results of logic expressions (boolean). This mapping is executed by logical or point operators that do overlay between the Information layers classes. The boolean expressions can be combined using operators such as: && (AND logic, intersection), || (OR logic, union) and ! or ~ (not, complement). It is also possible to compare the image pixels or grid values through the operators <, >, <=, >=, == and !=; or compare classes of thematic ILs using the operators == and !=. It is possible to involve up to 40 ILs simultaneously. Syntax variable = Assign(CategoryOut = "category_name") As an alternative, the syntax below can be used: variable = Assign { Considerations The thematic geo-classes used on the left side of ":" must geo-classes from the thematic category associated to the thematic variable previously declared. The reserved word "Others" is optional and defines a value to be assigned in case the previous alternatives do not fit. The boolean expressions operate over the involved data raster representations and are point operations. Example: theme = Assign (CategoryOut = "AgricultureAptness") { "Good" : (soil.theme == "Le" && decl >= 0.05), "Medium" : (soil.theme == "Aq" || decl >= 0.10), "Bad" : (soil.theme == "Aq" &! decl >= 0.10), "xx" : Others; } SliceIt generates a Thematic information layer from numeric data. The processing rules are based on a slicing table created using the New operator. Syntax: pist = Slice (pien,tabfat) Considerations The pist variable must be a Thematic information layer. The pien parameter must be a Numeric information layer. The tabfat parameter must be a slicing table. Examples: { // Begin of program // Declarations Thematic classes_decl ("Slope_range"); Numeric decli ("Slope"); Table sslice(Slicing); // Instantiation sslice = New (CategoryOut = "Slope_range", [0.0, 5.0] : "low", [5.0, 15.0] : "medium", [15.0,45.0] : "high"); decli = Retrieve(Name = "slope_grid"); classes_decl = New(Name="decli_slic", ResX = 40, ResY = 40, Scale = 100000); // Operation classes_decl = Slice(decli,sslice); // End of program } WeightIt generates a Numeric information layer from thematic data. The processing rules are based on a weighting table created using a command with the New operator. Syntax: pisn = Weight (piet,tabpond) Considerations A pisn variable must be a Numeric information layer. The piet parameter must be a Thematic information layer. The tabpond parameter must be a Weighting table. Example: { // Begin of program // Declarations Thematic geom ("Geomorphology"); Numeric fragil ("fragility"); Table tab_geo (Weighting); // Instantiation fragil = New (Name = "soil_fragility",ResX = 50, ResY = 50, Scale = 100000); tab_geo = New (CategoryIn = "Geomorphology", "SEpt" : 1.2, "Espp" : 1.1, "Estb" : 1.3, "dk" : 2.4); geom = retrieve(Name = "Geomor_RADAM"); // Operation fragil = 0.5 * Weight(geom,tab_geo); // End of program } ReclassifyIt remaps the themes of a thematic information layer to a new thematic layer. This remapping is done following the rules described in a reclassification table. This is a generalization operation where different input themes are remapped to an output theme. Syntax pisn = Reclassify (piet ,table_reclass) Considerations The pisn variable must be a Thematic information layer. The piet parameter must be a Thematic information layer. The table_reclass parameter must be a Reclassification table previously instantiated by the New operator. Examples: { // begin of program // Declarations Thematic coverage ("Forest"); Thematic deforest ("Deforestation"); Table table_reclass(Reclassification); // Instantiation table_reclass = New (CategoryIn = "Forest", CategoryOut = "Deforestation", "Dense_Forest" : "Forest", "Cultivated_plain" : "Forest", "Rebrota" : "Deforestation", "Deforested_Area" : "Deforestation"); coverage = Retrieve(Name = "coverage_types"); deforest = New (Name = "deforestation", ResX = 30, ResY = 30, Scale = 100000); // Operation deforest = Reclassify (coverage,tab_reclass); // End of program } ? : (Conditional Operator)It implements a conditional expression from the outcome of a boolean expression evaluated before the sign ?. If the boolean expression is true, the output variable assumes the outcome of the expression before the ":" sign; otherwise, it assumes the outcome after the ":" sign. Syntax variable = boolean_expression ? expression1 : expression2 Considerations The types of the output variable, expression1 and expression2 must be compatible. Examples: { // begin of program // Declarations Image tm345, tm5M ("Images"); Thematic use ("Soil_use"); // Instantiation use Retrieve (Name = "SoilUse"); tm345 = Retrieve (Name = "TM345"); tm5M = New (Name = "test", ResX=30, ResY=30); // Operation conditional tm5M = use.Class=="city" ? tm345 : 240; // End of program } SliceAttribute (or ReclAtrib )It creates a thematic IL in relation to ranges of values of numeric attribute defined to objects represented in a cadastral IL. The ranges are defined by a variable of Slicing Table type. The operator executes the transformation over the vector representation and generates a vector representation as an outcome. Syntax variable = SliceAttribute (object, attribute, tab_fat) OnMap cadastral_il; Examples: { Attribute pop ("Community_O", "population"); Object com ("Community_O"); Cadastral cad ("Community_Map"); Thematic tem ("Thematic_ranges"); Table fat (Slicing); cad = Retrieve (Name = "CommunityMap"); tem = New (Name ="population", ResX =100, ResY =100, Scale =100000, Repres =Raster); fat = New ( CategoryOut= Population", [1000, 2000] : "Low", [2000, 5000] : "Medium", [5000, 10000] : "High" ); tem = ReclAtrib (com, pop, fat) OnMap cad; } ZonalAverageIt calculates the average value inside each zone (region) of an information layer referenced by the pie argument. The zones are defined, one by one, by the zones_list. Syntax Numeric grid outcome pis = ZonalAverage ( pie, zones_list ) Single Numeric Value outcome vr = ZonalAverage ( pie, zone ) Numeric outcome in an Objects Attributes Table Object."atr" = ZonalAverage ( pie, object OnMap pic ) Considerations: pie - input information layer that defines values inside each geographic region evaluated. The pie information layer must be Image or Numeric types. zones_list - Identifies zones over which the average values will be calculated. All zones that are on the zones_list must be located on the pie geographic region. A zones_list can be defined by a list of boolean expressions or by all thematic classes existent in a thematic information layer. pis output information layer of Numeric type. vr - float variable that receives the resulting average value of a single region. Object."atr" - Attribute of an object represented on the pic information layer. pic - Cadastral information layer representing a set of regions. In case of numeric grid result, all positions in the numeric grid inside a zone will receive an average value calculated over that zone. Examples: { // Begin of program // Declarations Thematic zones ("Soils_vale_paraiba"); Numeric ph ("ph_soil_vale_paraiba"); Numeric ph_average ("grid_zonal_average_10x10"); Float ph_purple_soil; // Instantiation // Input data ph = Retrieve(Name = "ph_soil_sjc"); zones = Retrieve(Name = "soil_sjc");ph_average = New(Name = "ph_average_soil_sjc", ResX= 10, ResY= 10, Scale = 100000, Min = 0, Max = 20); // Operation // Numeric Outcome for specific regions ph_average = ZonalAverage(ph,zones.Class == "purple_soil", zones.Class == "latosoil_red", zones.Class == "soil_hydromorphic"); // Numeric outcome for the thematic classes // inside the thematic information layer - "soil_sjc". // In this case, each type of soil defines a region. ph_average = ZonalAverage(ph,zones.Class * ); // Outcome in a single numeric value ph_purple_soil = ZonalAverage(ph,zones.Class == "purple_soil"); }
// Program of zonal average that updates the attributes table { // Begin of program // Declarations Object regions ("districts"); Cadastral districtsmap ("mapcad"); Digital altimetry("altime"); districtsmap = Retrieve (Name = "districts"); altimetry = Retrieve (Name = "alt"); // Numeric outcome in the Objects Attributes Table regions."altitudeM" = ZonalAverage (altimetry,regions OnMap districtsmap); } ZonalMaximumIt identifies the maximum value inside each zone (region) of an information layer referenced by the pie argument. The zones are defined, one by one, by the zones_list. Syntax: Numeric grid outcome.
Single numeric value outcome.
Numeric outcome in an Objects Attributes Table.
Considerations: pie - the input Information layer that defines the values inside each geographic region evaluated. The pie information layer must be Image or Numeric types. zones_list -Identifies zones over which the maximum values will be calculated. All zones that are on the zones_list must be located on the pie geographic region. A zone or region can be identified by a boolean expression or object. A zones_list can be defined by a list of boolean expressions or by all thematic classes existent in a thematic information layer. pis - output information layer of Numeric type. vr - float variable that receives the maximum value inside a single region. Object."atr" - Attribute of an object represented on the pic information layer. pic - Cadastral information layer representing a set of regions. In case of numeric grid result, all positions in the numeric grid inside a zone will receive the maximum value calculated over that zone. Examples: { // Begin of Program // Variables used as restriction Thematic zon("Soil_types"); Image tm5("TMimages"); Numeric ph("ph_soil"); Numeric maximum_ph_zonal("grid10x10"); Float reflec_max_purple_soil; ph = Retrieve(Name = "ph_soil_sjc"); zon = Retrieve(Name = "soil_sjc"); maximum_ph_zonal = New(Name = "ph_maximum_zonal_sjc", ResX = 10, ResY = 10, Scale = 100000, Min = 0 Max = 200); // Numeric Outcome maximum_ph_zonal = ZonalMax(hp,zon.Class == "purple_soil", zon.Class == "latosoil_red", zon.Class == "soil_hydromorphic"); // Numeric Outcome for thematic classes inside the thematic information layer "soil_sjc". // In this case, each type of soil defines a region. ph_average = ZonalMax (ph.zon.Class * ); // Single numeric value outcome reflec_max_purple_soil = ZonalMax(tm5,zon.Class == "purple_soil"); // End of Program }
// Program of zonal maximum updating attributes table { // Begin of program // Declarations Object regions ("districts"); Cadastral districtsmap ("mapcad"); Digital altimetry("altime"); districtsmap = Retrieve (Name = "districts"); altimetry = Retrieve (Name = "alt"); // Numeric Outcome in an objects attributes table regions."altitudeMax" = ZonalMax (altimetry,regions OnMap districtsmap); } SpatializeIt allows values referring to a certain object attribute to be mapped in a Geo-field of a Thematic or Digital model. In the first case, textual attributes are associated to thematic classes; on the second case, attribute numeric values are represented in a grid. In both cases, isovalues regions are defined from entities previously associated to objects in a cadastral map. Syntax Thematic or Digital (geo-field) Outcome.
Considerations: tem is the variable name associated to the output information layer, previously declared in the program. The tem variable must be associated to a certain thematic category, whose previously defined classes must have identical names to the possible textual values of the attributes considered for spatialization. dig is the name of a variable associated to the output information layer, previously declared in the program under a certain digital category. obj is the variable name associated to the geo-objects of an objects model category. These geo-objects, previously associated to entities of the cadastral map, must have their attributes fields filled in with numeric values or names of thematic classes. "ATR_TEXTUAL" is the name of the text attribute we want to spatialize; each possible value of this attribute must be identical to the name of a thematic category associated to the IL represented by the tem variable. The attribute name must be written in capital letters. "ATR_NUMERIC" is the name of an integer or real attribute we want to spatialize. The attribute name must be written in capital letters. cad is a variable declared in the program as being of a certain category from the Cadastral model, associated to an information layer whose entities represent objects involved in the spatialization. Examples: { // Begin of program // Declaration of variable names Object limits ("strips"); Cadastral farms ("maefarms"); Thematic tem ("soil"); Numeric ph_soil("grid_ph") // Instantiation //Input data farms = Retrieve (Name = "mt"); tem = New (Name="soil_map", ResX =30, ResY =30, Scale =10000, Repres =Vector); Outcome in Thematic geo-field tem = Update (limits."SOIL" OnMap farms); Outcome in Numeric field ph_soil = Update (limits."ph" OnMap farms); } UpdateIt Updates an attribute of the objects given by the variable obj, previously associated to entities in a cadastral map, given by the variable cad, and from values obtained by the application of zonal operators over a reference information layer, given by the pie variable whose zones are given by the polygons on the cadastral map (cad). Syntax
Considerations: obj is the variable name associated to the geo-objects of an objects model category. This is the name of a variable associated to geo-objects of an objects model category. These geo-objects, previously associated to entities of the cadastral map, must have their attributes fields filled in with numeric values or names of thematic classes. pie is name associated to the input Information layer, previously declared in the program and associated to a certain thematic or digital category. The zonal operation must be coherent to the data model represented by the IL, i.e., some operators do not make sense with certain reference data. For instance, a ZonalAverage operation is not feasible in a thematic information layer. ATTR is the attribute name we want to update which is referred to each object to the objects category, associated to the obj variable, associated to entities of a cadastral map. cad is a variable declared in the program as being of a certain category from the Cadastral model. Examples: // This Program updates a table with zonal average operation { Object regions ("districts"); Cadastral districtsmap ("mapcad"); Digital altimetry("altime"); districtsmap = Retrieve (Name = "districts"); altimetry = Retrieve (Name = "alt"); regions."AverageAltitude" = Update ( altimetry,regions OnMap districtsmap, MedZ) ; } // Program that updates table with zonal maximum operation { Object regions ("districts"); Cadastral districtsmap ("mapcad"); Digital altimetry("altime"); districtsmap = Retrieve (Name = "districts"); altimetry = Retrieve (Name = "alt"); regions."MaximumAltitude" = Update (altimetry,regions OnMap districtsmap, MaxZ); } ZonalMinimumIt identifies a minimum value inside each zone (region) of an information layer referenced by the pie argument. The zones are identified, one by one, by the zones_list. Syntax Numeric outcome (geo-field).
Single Numeric outcome
Numeric outcome in an Object Attributes Table
ZonalVariety
Numeric outcome (geo-field).
Single Numeric outcome
ZonalRangeSyntax: Numeric outcome (geo-field). pis = ZonalRange (pie,zones_list) Single Numeric outcome vr = ZonalRange (pie,zone)
![]() |