Skip to content

Commit

Permalink
Update QC districts (2021)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jun 25, 2024
1 parent bc611db commit ec330f8
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
*.pyc
/node_modules
/vendor
/topojson/*.geojson
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'dbf'
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GEM
remote: https://rubygems.org/
specs:
dbf (4.2.4)

PLATFORMS
universal-darwin-23

DEPENDENCIES
dbf

BUNDLED WITH
2.3.12
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["NAD_1983_MTQ_Lambert",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",800000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-70.0],PARAMETER["Standard_Parallel_1",50.0],PARAMETER["Standard_Parallel_2",46.0],PARAMETER["Latitude_Of_Origin",44.0],UNIT["Meter",1.0]]
Binary file not shown.
Binary file not shown.
28 changes: 20 additions & 8 deletions boundaries/ca_qc_districts/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
22005: ["Sainte-Catherine-de-la-Jacques-Cartier", "districts"],
22010: ["Fossambault-sur-le-Lac", "districts"],
22015: ["Lac-Saint-Joseph", "districts"],
22020: ["Shannon", "districts"],
22035: ["Stoneham-et-Tewkesbury", "districts"],
22040: ["Lac-Beauport", "districts"],
22045: ["Sainte-Brigitte-de-Laval", "districts"],
Expand All @@ -68,11 +69,11 @@
32013: ["Saint-Ferdinand", "districts"],
32033: ["Princeville", "districts"],
32040: ["Plessisville", "districts"],
32045: ["Plessisville", "districts"],
32065: ["Lyster", "districts"],
33045: ["Saint-Agapit", "districts"],
33052: ["Saint-Flavien", "districts"],
34030: ["Cap-Santé", "districts"],
34038: ["Saint-Basile", "districts"],
34120: ["Lac-Sergent", "quartiers"],
35027: ["Saint-Tite", "districts"],
36033: ["Shawinigan", "districts"],
Expand All @@ -94,16 +95,18 @@
44071: ["Compton", "districts"],
45060: ["Sainte-Catherine-de-Hatley", "districts"],
45072: ["Magog", "districts"],
45115: ["Orford", "districts"],
46050: ["Dunham", "districts"],
46058: ["Sutton", "districts"],
46075: ["Lac-Brome", "districts"],
46078: ["Bromont", "districts"],
46080: ["Cowansville", "quartiers"],
46080: ["Cowansville", "districts"],
46112: ["Farnham", "districts"],
47017: ["Granby", "districts"],
47025: ["Waterloo", "districts"],
47047: ["Roxton Pond", "districts"],
48028: ["Acton Vale", "districts"],
48038: ["Upton", "districts"],
49048: ["Saint-Germain-de-Grantham", "districts"],
49058: ["Drummondville", "districts"],
49070: ["Saint-Cyrille-de-Wendover", "districts"],
Expand Down Expand Up @@ -152,7 +155,6 @@
60005: ["Charlemagne", "districts"],
60013: ["Repentigny", "districts"],
60028: ["L'Assomption", "districts"],
60035: ["L'Épiphanie", "districts"],
61025: ["Joliette", "districts"],
61027: ["Saint-Thomas", "districts"],
61030: ["Notre-Dame-des-Prairies", "districts"],
Expand Down Expand Up @@ -187,7 +189,7 @@
67010: ["Saint-Philippe", "districts"],
67015: ["La Prairie", "districts"],
67020: ["Candiac", "districts"],
67025: ["Delson", "quartiers"],
67025: ["Delson", "districts"],
67030: ["Sainte-Catherine", "districts"],
67035: ["Saint-Constant", "districts"],
67045: ["Mercier", "districts"],
Expand Down Expand Up @@ -225,6 +227,7 @@
72025: ["Saint-Joseph-du-Lac", "districts"],
72032: ["Oka", "districts"],
72043: ["Saint-Placide", "districts"],
72802: ["Kanesatake", "districts"],
73005: ["Boisbriand", "districts"],
73010: ["Sainte-Thérèse", "districts"],
73015: ["Blainville", "districts"],
Expand All @@ -241,12 +244,14 @@
77035: ["Sainte-Anne-des-Lacs", "districts"],
77055: ["Lac-des-Seize-Îles", "districts"],
77060: ["Wentworth-Nord", "districts"],
77065: ["Saint-Adolphe-d'Howard", "districts"],
78010: ["Val-David", "districts"],
78047: ["Saint-Faustin—Lac-Carré", "districts"],
78055: ["Montcalm", "districts"],
78070: ["Amherst", "districts"],
78095: ["Lac-Supérieur", "districts"],
78102: ["Mont-Tremblant", "districts"],
79037: ["Rivière-Rouge", "districts"],
79078: ["Lac-des-Écorces", "districts"],
8053: ["Matane", "districts"],
81017: ["Gatineau", "districts"],
Expand All @@ -265,8 +270,13 @@
89008: ["Val-d'Or", "districts"],
89015: ["Malartic", "districts"],
89040: ["Senneterre", "quartiers"],
89804: ["Lac-Simon", "districts"],
90012: ["La Tuque", "districts"],
9077: ["Mont-Joli", "districts"],
90801: ["", "districts"],
90802: ["Wemotaci", "districts"],
90804: ["Obedjiwan", "districts"],
9092: ["Sainte-Luce", "districts"],
93005: ["Desbiens", "quartiers"],
93012: ["Métabetchouan—Lac-à-la-Croix", "districts"],
93020: ["Hébertville", "districts"],
Expand All @@ -286,6 +296,8 @@
96030: ["Pointe-aux-Outardes", "districts"],
96040: ["Ragueneau", "districts"],
97007: ["Sept-Îles", "districts"],
97802: ["Uashat", "districts"],
97804: ["Maliotenam", "districts"],
99060: ["Eeyou Istchee Baie-James", "quartiers"],
}

Expand Down Expand Up @@ -425,7 +437,7 @@ def district_ider(f):

boundaries.register('{} {}'.format(name, type),
domain='%s, QC' % name,
last_updated=date(2017, 11, 30),
last_updated=date(2023, 5, 1),
name_func=district_namer,
id_func=district_ider,
authority='Directeur général des élections du Québec',
Expand All @@ -438,7 +450,7 @@ def district_ider(f):

boundaries.register('Paroisse de Plessisville districts',
domain='Plessisville, QC',
last_updated=date(2017, 11, 30),
last_updated=date(2023, 5, 1),
name_func=district_namer,
id_func=district_ider,
authority='Directeur général des élections du Québec',
Expand Down Expand Up @@ -540,7 +552,7 @@ def district_ider(f):

boundaries.register('%s districts' % name,
domain='{}, {}, QC'.format(name, geographic_name),
last_updated=date(2017, 11, 30),
last_updated=date(2023, 5, 1),
name_func=district_namer,
id_func=district_ider,
authority='Directeur général des élections du Québec',
Expand All @@ -553,7 +565,7 @@ def district_ider(f):

boundaries.register('%s boroughs' % geographic_name,
domain='%s, QC' % geographic_name,
last_updated=date(2017, 11, 30),
last_updated=date(2023, 5, 1),
name_func=borough_namer,
id_func=lambda f: int(f.get('NO_ARON')),
authority='Directeur général des élections du Québec',
Expand Down
5 changes: 3 additions & 2 deletions boundaries/ca_qc_districts/sets.rb
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env ruby
require 'csv'
require 'open-uri'

Expand All @@ -15,12 +16,12 @@

sets = {}

DBF::Table.new(File.expand_path('Districts_Mun_2017_11_30.dbf', __dir__)).each do |record|
DBF::Table.new(File.expand_path('Districts_Quartiers_Mun_election_2021_region.dbf', __dir__)).each do |record|
unless %w(ÉI RI).include?(record['CO_DESIGN'].force_encoding('iso-8859-1').encode('utf-8'))
sets[record['CO_MUNCP']] = record['MODE_SUFRG']
end
end

sets.each do |k,v|
sets.sort_by{|k,v| k.to_s}.each do |k,v|
puts %( #{k}: ["#{names[k]}", "#{v == 'Q' ? 'quartiers' : 'districts'}"],)
end

0 comments on commit ec330f8

Please sign in to comment.