Saturday 22 March 2014

Generating themes by external lookup values

Ever generate an individual theme on a property and get frustrated at the labels that are generated because your property is basically a "foreign key", where the real descriptive labels come from the lookup table that the foreign key points to?


Sure you could set up a view (if your Feature Source is a relational database) to include the descriptive label properties or (gasp) make an Extended Feature Class that uses Feature Joins to pull in the description properties, but there's overhead involved when theming on strings as opposed to theming on numerical lookup ids.

Wouldn't it be nice if there's a way where we can theme based on description values from a lookup table but retain the ability to theme by the base numerical or string lookup id?

In the next release of MapGuide Maestro, we've solved this problem for you.

Meet the new Theme Generation dialog


The Data Setup portion of the dialog has been split into 2 sections:

  • Theme based on values/ranges from this class: This is the existing theming option
  • Theme based on values from an external class: This is the new theming option where you can source the theme rules from an external class definition (eg. A lookup table)
To illustrate this new feature, consider we're theming against the Parcels Feature Source from the Sheboygan Sample data set (as per the above screenshot). We'd pick the RTYPE property, which tells us that 8 theme rules will be created.


Now unfortunately, the RTYPE property only contains abbreviated values and the theme that gets generated doesn't produce very informative labels (as seen in the first screenshot).

Now suppose we had an external Feature Source or lookup table that has descriptive labels for these RTYPE values.


We can use the new theming option to generate theme rules using the main property as a frame of reference.

Firstly, you would specify the Feature Source containing your lookup table


Then specify the Feature Class that represents the lookup table


Then you specify the key and value properties that will determine the filters and labels that will be generated for your theme rules.


If you want to apply any filtering on the lookup table itself to reduce the number of rules that would be generated, you can specify the FDO filter in the Filter field.

Then click Update to get a feel for the number of rules that will be generated. The rules that will be generated follow this form:
  • Filter: RTYPE = [Value of Default:ParcelType.Type]
  • Label: [Value of Default:ParcelType.Description]

At this point, you can then tweak the color setup and other theme generation settings as before. Once you click OK you can see that the theme rules generated match the values from your lookup table.


As you can hopefully see, this feature should dramatically simplify theming of features from relational databases without requiring any table/view contortions to get the desirable theme rules.

No comments: