Showing results for 
Search instead for 
Do you mean 

Spatial Modeler Language (SML) FAQ''s

by Technical Evangelist on ‎09-22-2015 06:10 AM - edited on ‎03-28-2016 12:26 PM by Anonymous (682 Views)

What is SML?

  • Spatial Modeler Language (SML) is a spatial analysis script based language for manipulating raster and vector data.
  • It is the underlying script for Model Maker
  • It is the basis for most Image Interpreter functions.

 

What can I do with SML?

  • SML is a script language that is designed for GIS modeling and image processing applications.
  • SML allows the definition of simple or complex processing operations outside the Model Maker, the GUI in the Spatial Modeler component.
  • Models created by Model Maker can be edited with SML.
  • Models created or edited using SML cannot be accessed from Model Maker.
  • The EML Job command can be used to run SML scripts.

What kind of operations can done with SML?

Mathematical operations on raster layers (adding, subtracting, multiplying, ratios, image algebraic functions), and convolution filtering

  • Neighborhood analyses (analyzing a pixel based on the values of neighboring pixels)
  • Subset and mosaic
  • Principal component analysis
  • Proximity analysis
  • Contiguity analysis
  • Descriptor table manipulation

Why should I learn SML?

  • It provides extended functionality beyond Model Maker: flow control and looping.
  • Optimize models for functionality.
  • Understanding SML aids in debugging models.

How do I learn SML?

  • Read the on-line help for Spatial Modeler
  • Look at examples: Image Interpreter and generate script from Model Maker models
  • Leica Geosystems Training courses in advanced modeling from Leica Geosystems Education Services.

Can I customize and extend using SML & EML?

New applications can be built using SML. The Image Interpreter in ERDAS IMAGINE is built primarily from SML scripts with an EML interface. Once you have developed a new algorithm using the graphical Model Maker environment, you can generate an SML script that can be combined with a custom developed user interface using EML. The new application may be plugged into the existing ERDAS IMAGINE menu structure so that it functions like any other part of the system.


What are the communication restrictions between EML, C Programmers' Toolkit with SML models?

  • Can run models from EML – syncjob
  • Can run models from C Programmers' Toolkit applications
  • Cannot run C Programmers' Toolkit functions or applications from model

What are the alternatives for doing the similar AOI operation in a pure C environment?


If you wanted to do more at the C level, you could register an input callback on the aoiname part (instead of the "on input" clause in the EML script), but you would still need to define the "aoiname" filename part in your EML script


 

Is there a way I can use control statements and perform looping in EML?


Yes! You can do that by using the switch and foreach statements. For more control statements see the on-line help in EML
SWITCH: Similar to C switch
Example:

switch( $localname.GetCategory() ) {
    case "Annotation": OpenAnnotationLayer($localname);
    case "Raster": OpenRasterLayer($localname);
    case "AOI": OpenAoiLayer($localname);
    case "Vector": OpenVectorLayer($localname);
}


FOREACH: Loop on each element in the array
Example:

set attnames = getfeaturefields( $vecfile, "0",
   $vectype, $attype ); 
foreach att in ($attnames) {
   set attdeclist = $attdeclist + $attype+
      "table t" + fmt($iatt,"0") + desriptor
      out::" + quote($att) + ";";
   set attcopylist = $attcopylist + "t" +
      fmt($iatt,"0") + "in::"+quot($att) + ";";
   set iatt = $iat + 1;
   }

Contributors