Extreme Ground logo

OpenLobby by eXtreme Ground

  1. QuickStart guide
  2. Installation guide
  3. User Manual
  4. Technical Manual
  5. Frequently Asked Questions
  6. Troubleshooting guide
  7. Report a problem or request a feature

Technical Manual

Postal Codes

A Canadian postal code is in the form A9A 9A9, where A is a letter and 9 is a digit. In addition the first character in the code identifies the province. Not all letters are used for the first character. D, F, I, O, P, Q, U, W & Z are not currently used but can be used elsewhere in the code.

OpenLobby by eXtreme Ground (OLEG) uses the first character to assign the code to a province.

Internally OLEG uses just the 6 non-blank characters in the postal code. The middle space is removed if it is in the input file. OLEG also attempts to fix common keying errors such as mixing up the number 1 with the letter I or L, or having a numeric entry shifted (e.g. $ instead of 4). This latter technique assumes an American English keyboard was used.

Corrections to the postal code are NOT saved!


Elections Canada gives each federal riding a unique 5-digit number. Elections Ontario uses the same last three digits for ridings with the same borders. Elections Ontario also uses the same names where the riding borders are the same.

There are some ridings that have different borders however. They may share the same last three digits in their number but not their name.

OLEG uses the federal codes or the 2-character provincial abbreviation + the provincial number to uniquely identify the riding. For example, 35072 is the federal riding of Pickering-Scarborough East while ON072 is the Provincial riding.

The RIDINGS.DBF table should not be modified. It contains all of the valid ridings and only the valid ridings.

Municipal Wards

Municipal wards in Ontario are identified with a number. This number is stored in the table of postal codes and is not translated. To do so would require identifying the municipality in the table, which would greatly complicate the program.

OLEG does not currently distinguish between Regional Municipalities and their constituent cities. This may change as the program expands to handles more municipalities.

The Postal Code table

POSTAL.DBF contains all of the postal codes along with their associated federal & provincial riding codes and the municipal ward numbers. It currently contains over 270,000 entries.

This table can be edited as a spreadsheet but this is not recommended. If you do edit the table, you must use the OLEG File menu "Rebuild indexes" option afterward.

The table currently contains only one entry for each postal code with only one associated federal and provincial riding and ward number. In a small number of instances this is not accurate. A few postal codes are split among as many as 4 ridings.

This is very difficult to handle programmatically so OLEG currently assigns the postal code to just one riding. This will likely change in a future release.


The prefered method for updating the postal code table is to create a dBASE file using your spreadsheet program. The spreadsheet should contain 4 columns with column headings (like the membership list). The column headings are not important but must be present. The 4 columns are (in order) postal code, federal riding name, provincial riding name, municipal ward number.

The riding names MUST match exactly the names in the RIDINGS.DBF file. If a corresponding postal code is found, it will be updated with the new information. Otherwise the new postal code will be added to the table.

About OpenLobby development

OpenLobby by eXtreme Ground was developed using the Lazarus IDE v9.30, a Free/Libre cross-platform development environment that uses the Free Pascal compiler.

The development uses a plain-vanilla installation of Lazarus with the exception of the fpspreadsheet package. This package is not part of the basic installation but was added to the OpenLobby project. I found it useful to make some changes to the fpspreadsheet.pas file to handle file opening and saving. These changes have been submitted back to Lazarus CCR for inclusion in a later release.

The program will not quite compile without the change to the WriteToFile procedure. The change uses the same logic as the ReadFromFile procedure to select the file type from the file name suffix so that it only requires the file name and overwrite flag.

I was hoping to have a full native Linux implementation but haven't resolved a problem in the import routine. Other than that, a native Linux version is available upon request.

The 32 bit Windows version was developed on a Linux-based computer running Wine and tested on both Linux and a Windows XP virtual machine. The source code was then recompiled on a Windows XP / 64 bit virtual machine and repackaged for the 64 bit installer.

The Windows installers were created using Inno Setup (available free at www.jrsoftware.org.

No actual Windows computers were used in making this software.