Set Redistricter statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Changes the characteristics of a districts table during a redistricting session. You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax 1 (Change)

Set Redistricter districts_table 
	[ Change district_name 
		[ To new_district_name ] [ Pen... ] [ Brush... ] [ Symbol... ] ] 
	[ Add new_district_name [ Pen... ] [ Brush... ] [ Symbol... ] ]
	[ Remove district_name ] 

Syntax 2 (Order)

Set Redistricter districts_table 
	Order { "Alpha" | "MRU" | "Unordered" }

Syntax 3 (Percentage)

Set Redistricter districts_table 
	Percentage from { column | row }

Syntax 4 (Target)

Set Redistricter districts_table
	Target district_name

Syntax 5 (Selection)

Set Redistricter districts_table 
	Selection { As | To } Target

districts_table is the name of the districts table (for example, Districts).

district_name is a string representing the name of an existing district.

new_district_name is a string representing a new district name, used when adding a district or renaming an existing district.

Pen is a valid Pen clause to specify a line style. For example, Pen MakePen (width, pattern, color).

Brush is a valid Brush clause to specify fill style. For example, Brush MakeBrush (pattern, forecolor, backcolor).

Symbol is a valid Symbol clause to specify a point style. For example, Symbol MakeSymbol (shape, color, size).

Description

Set Redistricter modifies the set of districts that are in use during a redistricting session. To begin a redistricting session, use the Create Redistricter statement. For an introduction to redistricting, see the MapInfo Pro documentation.

To add, delete, or modify a district or districts, use Syntax 1. Use the Change clause to change the name and/or the graphical style associated with a district. Use the Add clause to add a new district. Use the Remove clause to remove an existing district; when you remove a district, map objects which had been assigned to that district are re-assigned to the "all others" district.

The district_name and new_district_name parameters must always be string expressions, even if the district column is numerical. For example, to refer to the district representing the number 33, specify the string expression "33".

To affect the ordering of the rows in the Districts Browser, use Syntax 2. Specify "Alpha" to use alphabetical ordering. Specify "MRU" if you want the most recently used district to appear on the top row of the Districts Browser. Specify "Unordered" if you want districts to be added to the bottom row of the Districts Browser as they are added.

To specify the target district by name, use Syntax 4. Use an empty string " " to indicate that the target should be the unassigned district.

To specify that the district of the selected object become the target district, use the As form of Syntax 5. This will only work if there is a single object selected and that object is in the source table. This is similar to using the Set Target District from Map menu item on the Redistricter menu except the selection can be from a query.

To specify that the selection should be made part of the current target district, use the To form of Syntax 5. This will only work if the selected objects are in the source table. This is similar to using the Assign Selected Objects menu item on the Redisctricter menu except the selection can be from a query.

Examples

Once a redistricting session is in effect, the following statement creates a new district.

Set Redistricter Districts 
	Add "NorthWest" Brush MakeBrush(2, 255, 0) 

The following statement renames the "NE" district to "NorthEast." Note that this type of change can affect the table that is being redistricted. Initially, any rows belonging to the "NE" district have "NE" stored in the district column. After the Set Redistricter... Change statement, each of those rows has "NorthEast" stored in that column.

Set Redistricter Districts 
	Change "NE" To "NorthEast"

The following statement removes the "NorthWest" district from the Districts table:

Set Redistricter Districts 
	Remove "NorthWest" 

The following statement sets the ordering of rows in the Districts Browser, so that the most recently used districts appear at the top:

Set Redistricter Districts 
	Order "MRU" 

The following statement makes the district "NorthEast" the target:

Set Redistricter Districts 
	Target "NorthEast" 

The following statements make the district that currently contains the province "Alberta" the target:

Select * from CANADA Where Province_Name = "Alberta"
Set Redistricter Districts 
	Selection As Target 

The following statements assign the provinces which had a 1994 population of fewer than 100,000 people to the current target district:

Select * from CANADA Where Pop_1994 < 100000
Set Redistricter Districts 
	Selection To Target 

See Also:

Create Redistricter statement