opennorth / represent-canada-data

Digital electoral boundary files for Canada, its provinces and municipalities
http://represent.opennorth.ca/
Other
46 stars 17 forks source link

Update PE (requires --merge specified for loadshapefiles). #36

Closed DrMeers closed 3 years ago

DrMeers commented 3 years ago

Please let me know if this looks correct. The shapefiles contain separate polygons for each polling area within each district. I ran it with:

./manage.py loadshapefiles --only='prince-edward-island-electoral-districts-2017' --merge=combine
Processing prince-edward-island-electoral-districts-2017.
Loading prince-edward-island-electoral-districts-2017 from ./data/shapefiles/boundaries/ocd-division/country:ca/province:pe/2017/2017_Provincial_Electoral_Districts.shp
belfast-murray-river...
belfast-murray-river...
belfast-murray-river...
belfast-murray-river...
belfast-murray-river...
belfast-murray-river...
belfast-murray-river...
belfast-murray-river...
georgetown-pownal...
georgetown-pownal...
georgetown-pownal...
georgetown-pownal...
georgetown-pownal...
georgetown-pownal...
georgetown-pownal...
new-haven-rocky-point...
new-haven-rocky-point...
new-haven-rocky-point...
new-haven-rocky-point...
new-haven-rocky-point...
new-haven-rocky-point...
new-haven-rocky-point...
morell-donagh...
morell-donagh...
morell-donagh...
morell-donagh...
morell-donagh...
morell-donagh...
morell-donagh...
morell-donagh...
cornwall-meadowbank...
cornwall-meadowbank...
cornwall-meadowbank...
cornwall-meadowbank...
cornwall-meadowbank...
cornwall-meadowbank...
cornwall-meadowbank...
cornwall-meadowbank...
borden-kinkora...
borden-kinkora...
borden-kinkora...
borden-kinkora...
borden-kinkora...
borden-kinkora...
borden-kinkora...
borden-kinkora...
borden-kinkora...
souris-elmira...
souris-elmira...
souris-elmira...
souris-elmira...
souris-elmira...
souris-elmira...
souris-elmira...
souris-elmira...
brackley-hunter-river...
brackley-hunter-river...
brackley-hunter-river...
brackley-hunter-river...
charlottetown-winsloe...
charlottetown-west-royalty...
brackley-hunter-river...
brackley-hunter-river...
brackley-hunter-river...
stanhope-marshfield...
stanhope-marshfield...
stanhope-marshfield...
stanhope-marshfield...
stanhope-marshfield...
stanhope-marshfield...
stanhope-marshfield...
stanhope-marshfield...
evangeline-miscouche...
evangeline-miscouche...
evangeline-miscouche...
evangeline-miscouche...
summerside-wilmot...
summerside-wilmot...
kensington-malpeque...
kensington-malpeque...
kensington-malpeque...
kensington-malpeque...
kensington-malpeque...
kensington-malpeque...
kensington-malpeque...
kensington-malpeque...
kensington-malpeque...
rustico-emerald...
rustico-emerald...
rustico-emerald...
rustico-emerald...
rustico-emerald...
rustico-emerald...
rustico-emerald...
rustico-emerald...
summerside-south-drive...
summerside-south-drive...
summerside-south-drive...
summerside-south-drive...
summerside-south-drive...
summerside-south-drive...
summerside-south-drive...
summerside-south-drive...
charlottetown-victoria-park...
charlottetown-victoria-park...
charlottetown-victoria-park...
charlottetown-victoria-park...
charlottetown-victoria-park...
charlottetown-victoria-park...
charlottetown-victoria-park...
charlottetown-victoria-park...
charlottetown-victoria-park...
charlottetown-west-royalty...
charlottetown-west-royalty...
charlottetown-west-royalty...
charlottetown-west-royalty...
charlottetown-west-royalty...
charlottetown-west-royalty...
charlottetown-west-royalty...
charlottetown-west-royalty...
charlottetown-hillsborough-park...
charlottetown-hillsborough-park...
charlottetown-hillsborough-park...
charlottetown-hillsborough-park...
charlottetown-hillsborough-park...
charlottetown-hillsborough-park...
charlottetown-hillsborough-park...
charlottetown-winsloe...
charlottetown-winsloe...
charlottetown-winsloe...
charlottetown-winsloe...
charlottetown-winsloe...
charlottetown-winsloe...
charlottetown-belvedere...
charlottetown-belvedere...
charlottetown-belvedere...
charlottetown-belvedere...
charlottetown-belvedere...
charlottetown-belvedere...
charlottetown-belvedere...
charlottetown-belvedere...
charlottetown-belvedere...
charlottetown-brighton...
charlottetown-brighton...
charlottetown-brighton...
charlottetown-brighton...
charlottetown-brighton...
charlottetown-brighton...
charlottetown-brighton...
charlottetown-brighton...
charlottetown-brighton...
mermaid-stratford...
mermaid-stratford...
mermaid-stratford...
mermaid-stratford...
mermaid-stratford...
mermaid-stratford...
mermaid-stratford...
oleary-inverness...
oleary-inverness...
oleary-inverness...
oleary-inverness...
oleary-inverness...
oleary-inverness...
oleary-inverness...
tignish-palmer-road...
tignish-palmer-road...
tignish-palmer-road...
tignish-palmer-road...
tignish-palmer-road...
tignish-palmer-road...
tignish-palmer-road...
tignish-palmer-road...
alberton-bloomfield...
alberton-bloomfield...
alberton-bloomfield...
alberton-bloomfield...
alberton-bloomfield...
alberton-bloomfield...
tyne-valley-sherbrooke...
tyne-valley-sherbrooke...
tyne-valley-sherbrooke...
tyne-valley-sherbrooke...
tyne-valley-sherbrooke...
stratford-keppoch...
stratford-keppoch...
stratford-keppoch...
stratford-keppoch...
stratford-keppoch...
stratford-keppoch...
montague-kilmuir...
montague-kilmuir...
montague-kilmuir...
montague-kilmuir...
montague-kilmuir...
montague-kilmuir...
montague-kilmuir...
montague-kilmuir...
summerside-wilmot...
summerside-wilmot...
summerside-wilmot...
summerside-wilmot...
summerside-wilmot...
summerside-wilmot...
summerside-wilmot...
summerside-south-drive...
charlottetown-winsloe...
morell-donagh...
souris-elmira...
belfast-murray-river...
georgetown-pownal...
stanhope-marshfield...
stratford-keppoch...
stratford-keppoch...
charlottetown-hillsborough-park...
charlottetown-hillsborough-park...
charlottetown-winsloe...
brackley-hunter-river...
brackley-hunter-river...
georgetown-pownal...
new-haven-rocky-point...
new-haven-rocky-point...
cornwall-meadowbank...
rustico-emerald...
kensington-malpeque...
tignish-palmer-road...
alberton-bloomfield...
oleary-inverness...
evangeline-miscouche...
evangeline-miscouche...
tyne-valley-sherbrooke...
charlottetown-hillsborough-park...
tyne-valley-sherbrooke...
evangeline-miscouche...
oleary-inverness...
oleary-inverness...
alberton-bloomfield...
alberton-bloomfield...
alberton-bloomfield...
alberton-bloomfield...
morell-donagh...
tyne-valley-sherbrooke...
tyne-valley-sherbrooke...
alberton-bloomfield...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
prince-edward-island-electoral-districts-2017 count: 28

And all looks correct in the Django admin.

jpmckinney commented 3 years ago

Hmm, I'm getting a server error: https://represent.opennorth.ca/boundaries/prince-edward-island-electoral-districts-2017/?format=apibrowser

The log files are not helpful.

I'm assuming it's due to the polygons without names (the ... lines at the end of the output). Can you make a PR to add: is_valid_func=lambda f: f.get('DISTRICT') ?

jpmckinney commented 3 years ago

Indeed, that fixes it. I'll make the commit.

DrMeers commented 3 years ago

Thanks @jpmckinney ! One more question though -- trying to fix the PE scraper, and I get pupa.exceptions.UnresolvedIdError: cannot resolve pseudo id to Post: ~{"label": "Tyne Valley - Sherbrooke", "organization__classification": "legislature", "role": "MLA"} -- how do I update scrapers-ca with the new boundaries from epresent-canada-data?

jpmckinney commented 3 years ago

Ideally, you would update this scraper: https://github.com/opencivicdata/ocd-division-ids/blob/master/scripts/country-ca/ca_pe_electoral_districts.rb

Otherwise, you can directly edit this CSV: https://github.com/opencivicdata/ocd-division-ids/blob/master/identifiers/country-ca/province-pe-electoral_districts.csv

Then, you need to re-compile the identifiers for Canada with this script: https://github.com/opencivicdata/ocd-division-ids/tree/master/scripts#usage

And create a PR against that repository. Once that's merged, you'd copy the updated country-ca.csv to https://github.com/opencivicdata/scrapers-ca

DrMeers commented 3 years ago

Aha! Thanks @jpmckinney , would not have figured that out on my own :)

And create a PR against that repository.

Done: https://github.com/opencivicdata/ocd-division-ids/pull/248

DrMeers commented 3 years ago

Once that's merged

Or theoretically beforehand / in faith? See https://github.com/opencivicdata/scrapers-ca/pull/270

jpmckinney commented 11 months ago

Hmm, I merged this without realizing that I had already added PEI in the private repo (we don't actually have an open data license for the files in this PR). I might have just not deployed it at the time.