Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add election districts #12

Open
ouzor opened this issue May 15, 2014 · 11 comments
Open

Add election districts #12

ouzor opened this issue May 15, 2014 · 11 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@ouzor
Copy link
Contributor

ouzor commented May 15, 2014

Update then data(aluejakokartat) in helsinki.

@jlehtoma
Copy link
Contributor

jlehtoma commented Aug 5, 2014

Issue needs a bit more description.

@antagomir
Copy link
Member

The shape files for each election district division mentioned above are available from different sources. It would be handy to have a function to retrieve the selected division, for instance: "get election districts used in Turku 2014". Helsinkin districts are available through HRI, Turku districts from Lounaispaikka

@ouzor
Copy link
Contributor Author

ouzor commented Aug 5, 2014

What I had in mind here was function get_election_district(city, year), and then each available combination would be hard coded. So currently combinations (Helsinki, 2011), (Helsinki, 2014), and (Turku, 2014) would work, others would result in NULL.

@jlehtoma
Copy link
Contributor

jlehtoma commented Aug 5, 2014

Is there anything else but Helsinki in the package currently (a83a0cb)?

@ouzor
Copy link
Contributor Author

ouzor commented Aug 5, 2014

No, there's currently only election maps for Helsinki region (year 2011), implemented in get_helsinki_aluejakokartat(). So it should be removed from there, and created to a new function get_election_districts(). Then (Helsinki, 2014) and (Turku, 2014) could be added to the new function.

@antagomir
Copy link
Member

At least not for Turku but the shape files for that would be readily available from Lounaispaikka as soon as there is time to add to package. Check http://paikkatietokeskus.lounaispaikka.fi/fi/aineistot/ for "Turun Kaupungin Äänestysaluerajat" and also many other GIS data sets

@jlehtoma
Copy link
Contributor

jlehtoma commented Aug 5, 2014

Right, I'll see what I can do for rOpenGov/gisfin#11 first and then can come back to this unless someone wants to take a stab at it.

@jlehtoma
Copy link
Contributor

I created a new branch fix/issue9 which has the following new features:

  • Data downloading and extraction (from zip) refactored to a new function download_data()
    • Not all downloadables are necessarily zips, function tries to figure out if the target is a zip and extracts the zip
    • Implements a simple cache with overwrite capability
  • get_helsinki_aluejako() renamed to get_helsinki_adminboundaries() which now uses download_data()
    • all spatial data objects are returned in EUREF-FIN CRS (EPSG:3067)
  • Added new file turku_spatial.R which a single function get_turku_adminboundaries() which functions analogously to its Helsinki-counterpart
    • Currently 2 datasets are included: election districts and major districts (suuralueet)

@jlehtoma
Copy link
Contributor

Next steps from here:

  • Create a separate get_election_districts() which could call get_helsinki_adminboundaries() and get_turku_adminboundaries() accordingly
  • Add year specifiers somewhere, currently there are none

Note also that get_helsinki_adminboundaries() and get_turku_adminboundaries() are structurally very similar and could be refactored into a single function. The most flexible approach would be to separate the data source definitions from the implementation, e.g. a JSON or YAML file could include the necessary URLs, layer names, EPSG codes, years etc. Might be a bit of a pain to implement this, but the outcome would be much easier to maintain than coding an almost identical function for each city or creating one massive function with all the information hard coded. Thoughts?

@ouzor
Copy link
Contributor Author

ouzor commented Aug 10, 2014

Sounds excellent! I agree that my first implementation had a lot of repetition and hard coding, so you suggestion sounds much more easier to maintain in the future when the number of data sets (and cities providing data) will grow.

@muuankarski muuankarski changed the title Add separate function for election districts, include Helsinki (2011 and 2014) and Turku. Add election districts Jun 25, 2019
@muuankarski muuankarski transferred this issue from another repository Aug 6, 2019
@antagomir antagomir added this to the 1.0: First CRAN release milestone Jan 20, 2020
@antagomir antagomir added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed labels Jan 20, 2020
@antagomir antagomir assigned antagomir, jlehtoma and ouzor and unassigned antagomir and ouzor Jan 20, 2020
@antagomir
Copy link
Member

I propose that this is moved to helsinki or election package. Or: we can add wrappers later. I group this now to Phantasy milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants