Skip to content

Tasks: Request boundaries

James McKinney edited this page Nov 7, 2017 · 14 revisions

Note: If an upcoming federal, provincial or territorial election uses new boundaries, name the new boundary set with an appropriate parenthesized suffix. After the election, rename the old boundary set and update the representative set's boundary set in the Django admin.

If you need to know the EPSG code for a PRJ file, use the Prj2EPSG service.

Orientation

Read the README sheet of the master spreadsheet for an orientation.

At the start of each year, update the conditional formatting of the Next boundary column in the master spreadsheet to highlight a cell if its text contains the prior year.

A low priority task is determining whether municipalities without a value in the Shapefile? column and with a value greater than 10,000 in the Population column have subdivisions, by finding the page for the municipal council on each website and evaluating whether members are elected per division or at-large. If it has no subdivisions, put N/A in columns G to N.

In the past, we trained non-experts to perform the tasks below using these instructions.

1. Sending a request to a government

If a government has an open data catalog according to Sheet1 of the private spreadsheet described in Tasks: Represent CSV Schema, we can send a request to the contact email in Sheet1. Note that, if it is a federal, provincial or territorial government, the request may need to go to its electoral offices. Otherwise, send the request to an appropriate address, like the GIS department, clerk's department, or general contact.

We have sample letters for common requests. Use the "Cold email" template to request the boundaries. Once the boundaries are received, if we don't have permission to distribute, send the "Permission to distribute" template; send it even if we've signed a licensing agreement that explicitly denies us permission, since we have received permission in such cases in the past. There are further templates in case the government doesn't respond to the cold email, in case we need to update the boundaries, or in case we need to clarify when the boundaries will be updated.

Update the master spreadsheet as documented in its README sheet throughout this process. If the government sends a licensing agreement, have a person with signing authority sign it, and save a copy in our file sharing system.

If the government refuses, send an FOI request. All governments fulfill FOI requests, and you should be able to find a form on their website. You may reuse wording from prior requests to ensure you receive an appropriate shapefile. To date, all our FOI requests have succeeded, although one had to go through mediation.

If you'll be sending dozens of emails, it will be easier to perform a mail merge using Google Apps Script. You may be able to reuse our old mail merge spreadsheet.

2. Importing the data into Represent

See these instructions and the represent-canada-data instructions. After creating the definition file and adding the data files, re-run the represent-canada-data maintenance tasks, setting the --base option to the new directory you created, except for the spreadsheet task which you should run as documented.

In rare cases, two boundary sets will have the same slug. To resolve the collision, change the slug of the least populated place by adding a province suffix (e.g. to disambiguate Richmond, QC from Richmond, NS) or by adding a type prefix (e.g. to disambiguate Ville de Plessisville from Paroisse de Plessisville). After changing its slug, you may need to delete the boundary set via the Django admin.

Then, load the shapefiles to the API with fab ohoh update_boundaries. Check for and correct any errors in the output. The most common error is that multiple boundaries in a boundary set have the same slug. Using ogrinfo or QGIS, check whether the shapefile has multiple features for the same boundary, like two features for "Ward 2". If so, use --merge union or --merge combine on only that boundary set, like fab ohoh update_boundaries:args="--merge union -d data/shapefiles/public/boundaries/ocd-division/country:ca/2013. Then, run fab ohoh update_boundaries again.