Maptitude GISDK Help

CreateTheme()

Summary

Creates a color or pattern theme on the current layer.

 

Changes

Optimal option added to Version 5.0.

 

Syntax

theme_name = CreateTheme(string identifier, string field_spec, string method, integer num_classes, array options)

 

Argument Contents
identifier The name you want to use for the theme
field_spec The field spec for the field on which the theme is based
method The method used to generate the classes, from the table below
num_classes The number of classes you want to create

 

Method How it works
Categories One value per class; the most frequent values are chosen first (the List of Values method in Maptitude)
Counts The values option specifies the number of features in each class
Equal Steps Each class has the same interval value (e.g., 0-50, 50-100, etc.)
Equal Weight Each class has a weighted sum that is roughly equal (supports the equal area and equal length options in Maptitude)
Manual The values option specifies the low and high values for each class
Nested Means The classes are created by first splitting the interval between the high and low value at the mean, and then recursively applying that procedure to each half until the desired number of classes have been defined. The number of classes must be a power of two and will be rounded up to achieve this, with a limit of 64 classes
Optimal Each class is a cluster of values that minimizes within-group variance using the Fisher-Jenks Algorithm version of the Optimal method of irregular class creation. This method is sometimes called Natural Breaks.
Percents The values option specifies the percentage of features in each class
Progression The classes are created using an arithmetic or a geometric progression, with settings controlled by the direction, rate, scale and type options
Standard Deviation The range of values in each class is the standard deviation times the value indicated in the scale option. If the number of classes is even, the classes start on either side of the mean; if the number of classes is odd, the first class is centered on the mean
Quantiles Each class contains roughly the same number of features (the Equal Number of Features method in Maptitude)

 

Option Type Contents
Data Source String Indicates which data are scanned to determine the minimum and maximum values. If "All" (the default), all features are scanned; if "Screen" only features appearing on the screen in the current map are scanned
Direction String Whether the class values in a progression theme are "Decreasing" (the default) or "Increasing"
Drop Empty Classes Boolean Whether classes containing zero features should be dropped from the theme (defaults to "False")
Force Other Display Boolean Forces the display of the Other class in the legend even if empty (defaults to "False")
Force Value Real Forces a break between classes at the specified value (Numeric Categories, Equal Steps, Equal Weight, Quantiles, Standard Deviation)
Include Maximum Boolean Whether the maximum value is included (default) or excluded from the range of data
Include Minimum Boolean Whether the minimum value is included (default) or excluded from the range of data
Maximum Value Real The maximum value to include in a class
Minimum Value Real The minimum value to include in a class
Other Boolean Whether to include a class (the "Other" class) for features whose values do not fall into any other class (defaults to "True")
Pretty Values Boolean Whether to round off the high and low values for each class to make them more presentable (defaults to "False")
Rate String The type of rate to use for a progression theme; one of : "Constant", "Decreasing" (the default), or "Increasing"
Retain Values Boolean Whether the data values used to create the theme are kept in memory (this option is normally used with TestTheme()); defaults to "False"
Scale Real Scaling factor for progression or standard deviation methods; defaults to 1.0
Sort Order String If "Descending" classes are created starting with the highest value and working downward; if "Ascending" (the default), classes are created starting with the lowest value and working upward (all numeric themes)
Statistics Boolean If "True" complete statistics are generated for the theme and all classes; if "False" only simple summary statistics are calculated (defaults to "False")
Style Boolean "True" for a pattern theme; "False" (the default) for a color theme
Title String Title of the theme, as it appears in the legend (defaults to theme_name)
Type String The type of progression for a progression theme: "Arithmetic" (the default) or "Geometric"
Values Array An array containing one element for each class in the theme. The contents of the elements varies by method, as shown below
Weight Field String For the equal weight method, the field spec of a numeric field used to weight the data values
Zero Boolean Whether zero is treated as a missing value (defaults to "False")

 

Method Contents of the values
Counts Integers that indicate the number of features in each class
Percents Real number that indicates the percentage of features in each class
Manual (string field) Strings that indicates the value for each class
Manual (numeric field) One of the following: real numbers that indicate the value for each class; or an array of {real low_value, boolean low_inclusive, real hi_value, boolean hi_inclusive} indicating the low and high values for each class

 

Returns

A string indicating the actual name of the theme.

 

Notes

Examples

// An income theme with eight classes

thm1 = CreateTheme("Income Theme", "County.Income", "Quantiles", 8, )

 

//This theme has a break in class values at $30,000, and the low and high values are rounded

thm2 = CreateTheme("Income Theme", "County.Income", "Quantiles", 8, {

     {"Force Value", 30000},

     {"Pretty Values", "True"}})

 

//This theme has classes that are created manually

thm3 = CreateTheme("Sales Theme", "Regions.Sales", "Manual", 5, {

     {"Values", {

          {0, "True", 1000, "False"},

          {1000, "True", 2500, "False"},

          {2500, "True", 10000, "False"},

          {10000, "True", 25000, "False"},

          {25000, "True", 100000, "True"}}

     }})

 

//This theme has classes containing the top ten; second ten; etc.

thm4 = CreateTheme("Sales Theme", "Customer|Sales", "Counts", 5, {

     {"Values", {10, 10, 10, 10, 10},

     {"Sort Order", "Descending"}

     }})

 

Error Codes

Error Meaning
Escape The user interrupted data scanning
Error An argument or option has the wrong type or the wrong number of values, or an error occurred while scanning the data
NotFound There is no current layer, or the specified field(s) do(es) not exist on the current layer, or the specified field(s) do(es) not contain any valid data

 

See Also

Function Summary
ShowTheme() Displays a theme on the current layer
ClearThemeValues() Remove the data used to generate a theme from memory
CreateChartTheme() Creates a pie or bar chart theme on the current layer
CreateContinuousTheme() Creates a continuous (scaled-symbol) theme on the current layer
CreateDotTheme() Creates a dot-density theme on the current layer
DestroyTheme() Removes the definition of a theme from the current layer
GetTheme() Gets information about a theme
GetThemes() Gets a list of themes defined on the current layer
SetThemeOptions() Change some theme options
TestTheme() Provides information on the classes created by a call to CreateTheme

 

 

©2025 Caliper Corporation www.caliper.com