The Simulated Territories Add-in allows you to automatically construct territories balanced by a chosen demographic. ​This tool uses artificial intelligence (AI) to automatically create and evaluate thousands of potential territory plans (sometimes referred to as ensembles or simulations) for creating equal and compact territories. If done by hand this would take an extraordinary amount of time!

To install:*

  1. Download the file ensemble-simulated-territories-add-in.exe.
  2. Double click the executable to launch the installation.
  3. Confirm that you’d like to allow the installer to make changes to your PC and follow the instructions in the installation wizard.
  4. Once installed, the add-in can be launched by opening a Maptitude map and choosing Tools>GIS Developer's Kit>Add-Ins>Ensemble Analysis.

*NOTE: The Simulated Territories add-in works only with Maptitude 2022 or later.

Using Ensemble Analysis

Ensemble Analysis uses a proprietary implementation of the ReCom method of the Markov chain Monte Carlo algorithm to randomly generate thousands of balanced territory layer tables and save the best ones for each metric you select. Maptitude automatically generates boundaries from random seeds as a starting point.

Territories are balanced using the balancing field chosen. The output table for the analysis includes all the tracking fields chosen.

The best territory layer tables for each selected metric can be saved as the ensemble analysis is executed. See Creating Territories from My Table in the Maptitude Help for information about creating a new territory layer using an existing table file.

Compactness and Deviation Metrics

Cut Edges Test

The Cut Edges test counts the number of edges removed (“cut”) from the adjacency (dual) graph of the working layer to define the territory layer. The adjacency graph is defined by creating a node for each working layer area. An edge is added between two nodes if the two corresponding working layer areas are adjacent: i.e., share a common linear boundary. If such a boundary forms part of the territory boundary, then its corresponding edge is “cut”. The measure is a single number for the territory layer. A smaller number implies a more compact territory layer. The measure should only be used to compare territory layers defined on the same working layer.

Example of cut edges with different boundaries

Cut Edges is a compactness measure proposed by Moon Duchin and her Metric Geometry and Gerrymandering group (

Total Abs. Deviation Measure

There are several ways of measuring how much a territory or the entire territory layer varies from the ideal. For Total Abs. Deviation, assume the following:

AbsoluteOverallRange = Popmax – Popmin (Also known as the "Total Population Deviation" or the "Overall Range")

Polsby-Popper Test

An average Polsby-Popper value can be used to constrain the ensembles. The Polsby-Popper test computes the ratio of the territory area to the area of a circle with the same perimeter: 4πArea/(Perimeter2). The measure is always between 0 and 1, with 1 being the most compact. The Polsby-Popper test computes one number for each territory.

To Create Territories Using Ensemble Analysis

  1. Open or create a map containing the area layer upon which you want to build the territories. If necessary create a selection set of the area to include in the territories (e.g., select all of the ZIP Codes in Connecticut if you want to build balanced territories for just the state of Connecticut).
  2. Choose Tools>GIS Developer's Kit>Add-Ins>Ensemble Analysis to open the Ensemble Analysis dialog box.
  3. Make changes to the map settings as follows:
    To do this... Do this...
    Choose the field from which to balance territoriesChoose the balancing field from the Balancing Field drop-down list
    Choose the areas to include when building territories Choose a set or Visible Features or All Features from the Selection drop-down list
    Set the number of iterations Type a value in the Iterations edit box
    Set the allowed deviation percent Type a value in the Deviation edit box
    Set the number of territories to createType a value in the Territories edit box
  4. To track additional fields in addition to the balancing field, click Choose Tracking Fields to display the Choose Tracking Fields dialog box, choose one or more fields from the Available Fields scroll list, click Add, and click OK.
  5. Highlight desired compactness and deviation metrics.
  6. Check Average Polsby-Popper must be at least and enter a minimum value if you want to constrain the results.
  7. Check Save the best territories table(s) for each metric and enter the number of ensembles to save.
  8. Click … and choose the desired drive and folder, then click Save.
  9. Check Launch Territory Wizard if you want to create territories from one of the best territory tables.
  10. Click OK.

Try it Yourself: Creating Balanced Territories

  1. From the Home Window, choose New Map of the United States and click OK.
  2. Highlight U.S. State, type CT in the Name box, and click Finish.
  3. Right-click on 5 Digit ZIP Code in the Display Manager, and choose Make Working Layer.
  4. Click Select by Condition button in the selection toolbar.
  5. Choose [State Abbrev] from the Field List drop-down list, choose = from the Operator List drop-down list, and type "CT" in the Enter a Condtion box to create the condition [State Abbrev] = "CT".
  6. Click OK to select all of the ZIP Codes in Connecticut.
  7. Choose Tools>GIS Developer's Kit>Add-Ins>Enesemble Analysis.
  8. Click the Balancing Field drop-down list, type 16+ to limit the list to fields with "16+" in their names and choose [16+_In labor force].
  9. Change Territories to 5.
  10. Click Choose Tracking Fields, type 16+ in the Filter edit box to limit the list to fields with "16+" in their names, and highlight [Workers 16+] and click Add.
  11. Click OK.
  12. Click OK to close the Note dialog box. Maptitude displays the Territory Wizard.
  13. Make sure From my territory table is chosen and click Next>.
  14. Click Next> again.
  15. Click Add button and choose Add Geography Layer Fields.
  16. Enter 16 in the Filter box, Crtl-click on [16+_In labor force] and [Workers 16+] in the scroll list, and click OK.
  17. Click Finish.

Maptitude will create territories from the ZIP Codes in Connecticut, balanced to have roughly equal values of population currently in the Labor Force.