Introducing Functional Attributes in Spatial Modeler

Way back with ERDAS IMAGINE 2013, a limited set of GeoMedia-based operators for features came to Spatial Modeler. Since then we’ve been asked repeatedly about our plans for everyone’s favorite analytical tool in GeoMedia – when will we have functional attributes in Spatial Modeler?

With GeoMedia and ERDAS IMAGINE 2018, the time has come, and it’s even more powerful than you might have imagined.  Let me introduce you.

Generate Functional Attributes

First, I’d like you to meet the Generate Functional Attributes operator.  We’re using active verbs at the front of the feature operator names (Create, Filter, Mask, Intersect, Add, Remove, etc.) so it’s quite a mouthful.  We affectionately call it GFA for short, and you can too.

GFA does precisely what you would expect:  it takes in some input Features and produces some output Features with additional attributes tacked on the end.  And, of course, sometimes produces more features than were input, if yours is an expansion-type expression.

Those additional attributes are defined by a new data type in Spatial Modeler: a FunctionalAttribute. It consists of a field name and an expression. Of course the expression, as in GeoMedia, determines the data type of the output field. (Sidebar: this new data type is used in several other contexts that I’ll cover at another time, including the Define Functional Attribute and Merge Features operators. You can anticipate its use in a future operator that provides the aggregation capability of GeoMedia.)

How do you define these functional attributes? It’s easy – invoke Spatial Model Editor, drag the GFA operator onto the canvas (look for it in the Feature Analysis category), and provide it with some input data via the Features Input operator. Then double-click the FunctionalAttribute1 port to define your first one, and you’ll see a dialog that – if you have any functional attribute experience in GeoMedia –  is an old friend. (Well, it’s not exactly the same, but you’ll definitely find it familiar!)

Set the field name to something meaningful, define that expression you’ve been pining for, and click OK. Back out on the canvas you’ll see that the field name is presented as the value on the port. We choose that because those expressions can get really loooooong.

A tip for naming output geometry fields: If you wish to have the new geometry field co-exist with the incoming geometry field, give it a different name. But if you wish to replace the original geometry field, make sure that both the original and new fields use the same name. This avoids unnecessarily perpetuating large geometries into the output Features; this is especially vital when you have an expansion-style expression which causes multiple new features to be generated from each original feature and therefore causes massive copying of the original geometries.

Need more than one functional attribute?  Right-click the operator and you’ll see a context menu with a variety of important tools. Here the Add Port and Remove Port actions let you control the number of functional attributes. By the way, if one or more of the new functional attributes produces a geometry field, then the last of those geometry fields will be declared the primary geometry field used by other downstream operators. (Tip: Use Set Primary Geometry operator to change this.)

Generally, the transition between GeoMedia functional attributes and Spatial Modeler functional attributes will be an easy one because all the concepts are the same. But not everything is the same!  Let’s cover some of the differences, starting with the dialog.

The New Dialog

There are many minor differences, including use of the more standard OK and Cancel rather than Add and Close, elimination of Undo and Paste buttons since use of Ctrl-Z and Ctrl-V are sufficient, and the ability to resize the dialog.

Of greater importance is the absence of the Text Length, Format, and Precision controls you’re accustomed to seeing in the upper right in GeoMedia. These are not in play with Spatial Modeler – it has no concept of fixed-length text fields or of presentation metadata such as format and precision.

A subtle change is the shift from “most commonly used functions” to “most recently used functions.” An MRU list is more conventional generally, and also better matches the MRU approach for operators used by Spatial Model Editor. One side effect is that the list is not pre-loaded with our selection of some common functions, as is done in GeoMedia. You have to use this dialog to populate this list!

You will also note a difference in the prefix used to uniquely identify attributes within expressions. GeoMedia has certain fixed values used for different commands/pipes including Input, Output, and Detail. Spatial Modeler uses the port name to qualify the attributes; FeaturesIn and FeaturesOut are the correct terms here.

The New Expression Engine

When it comes to the behavior of the operator itself, it takes advantage of two key differences with the 2018 release of Spatial Modeler. First, the operator is able to participate in Spatial Modeler’s new multi-threaded execution, and second, it can run under both 32-bit and 64-bit architectures. (Note: At this time GeoMedia installs only the 32-bit version but you can run the 64-bit version via ERDAS IMAGINE).

These improvements are possible because of a totally new expression engine underlying the operator. That new engine brings some changes in syntax as well as some new expression functions. A great deal of effort has gone into ensuring that there is high compatibility between the GeoMedia and Spatial Modeler expressions, but some small differences are inevitable. Here are some to be aware of:

  • It is necessary to explicitly cast content instead of counting on an implicit cast. This is necessitated by the internal technology, but it also prevents data loss caused when a user is not aware of the implicit cast.
  • The STATUS function is not provided because it has no role to play in the spatial modeling context.
  • The FORMATATTRIBUTE function is not provided. Attributes do not have metadata for display formatting in the spatial modeling context.
  • The LOOKUP function has moved from the Statistical function category to the Misc category.

New Expression Functions

GFA also introduces some additional expression functions beyond those available in GeoMedia.  Those operators, listed by function category, are:

  • Geometry
    • BUFFERRING – Returns a buffer ring from and to certain distances from the given geometry.
    • BUFFERZONE – Returns a buffer zone at a certain distance from the given geometry.
    • CONVEXHULL – Returns the convex hull of the given geometry.
    • FITTEDBOUNDINGBOX – Like the MBR function, but with the box oriented to optimally fit the data.
    • STROKE – Returns a polyline geometry with any input arcs stroked at 5-degree intervals.
  • Math & Trig – these are the hyperbolic equivalents to existing trigonometry functions
    • ACOSH
    • ASINH
    • ATANH
    • COSH
    • SINH
    • TANH
  • Misc
    • CHOOSE – Provides a more compact and easily used alternative to nested IF functions.
    • DECODE – Evaluates a set of conditions and returns the first condition evaluated to true.
    • SPLIT – Splits a text string into multiple text strings using a given delimiter.
    • TOP – Returns the top (highest) n values from a set of values.

Yes, you can create buffers today through the Buffer Zones operator. Providing it as an expression function here allows you to more easily incorporate buffers into larger and more complex functional attributes. This both increases efficiency in processing and simplifies model design.  In such a scenario, you can also go beyond just attribute-based distance values and build expression-based values computed on-the-fly from attributes.

You can also now create buffer rings as in GeoMedia, a capability not provided by the Buffer Zones operator.  Here is one using the expression: BUFFERRING(FeaturesIn.Geometry,10000,20000,Round) around some cities.

Buffer stacks as in GeoMedia can be accomplished through parallel use of multiple Buffer Zones or GFA instances.  For now I will leave this as an exercise for the reader!

The functions for creating convex hulls and fitted bounding boxes have long been requested in GeoMedia, so we are delighted to offer them here.  You can give them a go through the Run Spatial Model command of GeoMedia.  And the ability to stroke arcs and composite geometries should come in handy if you encounter operators or output formats that struggle to handle them.

Give It a Try!

Now that you’ve read about it, give it a go.  We hope you like it.  Next time I’ll cover the power you’ll find in the new Define Functional Attribute operator (DFA) for creating parameterized expressions and wrapper operators around GFA.

  • Start Planning Now for 2019

    HxGN LIVE gets better every year! Stay on top of your industry, relax with colleagues, and have a blast at next year's event.

  • Recent Posts

    More