GeoWahl visualizes geo–political data for the Web, Smartphone (iOS and Android) and Smartwatch (Apple Watch and Android Wear).
Platform–specific projects can be found here:
This repository provides an API for geo–political data and data visualization views.
The following routes return a Content-Type: application/json
response.
/elections
Returns all available elections, plus the associated data from the states, parties and results web services.
Response example: /elections
{
"elections": [
{
"id": 1,
"slug": "bpw16a"
"name": "BPW16 1. Wahlgang",
"states": [ ... ], // also retrieved by: /{electionSlug}/states
"parties": [ ... ], // also retrieved by: /{electionSlug}/parties
"results": [ ... ] // also retrieved by: /{electionSlug}/results
},
... // further elections
]
}
/{electionSlug}
Returns an available election for the provided electionSlug
, plus the associated data from the states, parties and results web services.
Response example: /bpw16b
{
"id": 2,
"slug": "bpw16b"
"name": "BPW16 2. Wahlgang",
"states": [ ... ], // also retrieved by: /{electionSlug}/states
"parties": [ ... ], // also retrieved by: /{electionSlug}/parties
"results": [ ... ] // also retrieved by: /{electionSlug}/results
}
/{electionSlug}/states
Returns all available states for an election, specified by electionSlug
.
Response example: /bpw16b/states
{
"states": [
{
"id": 0,
"slug": "results"
"name": "Alle Bundesländer"
},
{
"id": 1,
"slug": "w",
"name": "Wien"
},
... // further states
]
}
/{electionSlug}/parties
Returns all parties for an election, specified by electionSlug
.
NOTE Each party contains corresponding colors, which you can look up under the Parties Color Definition page.
Response example: /bpw16b/parties
{
"parties": [
{
"name": "Hofer",
"rgba": { "r": 14, "g": 66, "b": 142, "a": 1 },
"hex": "#0E428E"
},
{
"name": "VdB",
"rgba": { "r": 120, "g": 175, "b": 53, "a": 1 },
"hex": "#78AF35"
}
]
}
/{electionSlug}/{stateSlug}
Returns the total results for the provided stateSlug
.
NOTE When stateSlug
is set to results
, then the total results of all available states are returned.
NOTE The results
arrays always contain the following props:
name
: String – the party namevotes
: Integer – how many votes the party received (in context)percent
: Float (2 decimals) – the rounded votes percentageexact
: Float (all decimals) – the exact votes percentageResponse example: /bpw16b/results
or /bpw16b/w
{
"results": [
{
"name": "Hofer",
"votes": {PARTY_VOTES},
"percent": {PARTY_PERCENT_ROUNDED},
"exact": {PARTY_PERCENT_EXACT}
},
{
"name": "VdB",
"votes": {PARTY_VOTES},
"percent": {PARTY_PERCENT_ROUNDED},
"exact": {PARTY_PERCENT_EXACT}
}
]
}
/{electionSlug}/{stateSlug}/districts
Returns all districts and the corresponding results for the provided electionSlug
and stateSlug
.
NOTE The results
array format stays the same.
Response example: /bpw16a/w/districts
{
"districts": [
{
"id": 1,
"name": "Innere Stadt",
"results": [ ... ]
},
... // further districts
]
}
NOTE If stateSlug
is set to results
(see example below), then the total results of each available state are returned. In this case the property districts
will actually contain an array of states
and the total results for each corresponding state.
Response example: /bpw16b/results/districts
{
"districts": [
{
"name": "Wien",
"results": [
{
"name": "Hofer",
"votes": {PARTY_TOTAL_VOTES},
"percent": {PARTY_TOTAL_PERCENT_ROUNDED},
"exact": {PARTY_TOTAL_PERCENT_EXACT}
},
{
"name": "VdB",
"votes": {PARTY_TOTAL_VOTES},
"percent": {PARTY_TOTAL_PERCENT_ROUNDED},
"exact": {PARTY_TOTAL_PERCENT_EXACT}
}
]
},
... // further districts
]
}
/{electionSlug}/{stateSlug}/{districtId}
All–In–One – Returns the results for a district, specified by districtId
. Furthermore it returns the results for the parent state, specified by stateSlug
, and the results for the election, specified by electionSlug
.
NOTE The results
array format stays the same.
Response example: /bpw16b/w/1
{
"district": {
"id": 1,
"name": "Innere Stadt",
"results": [ ... ]
},
"state": {
"slug": "w",
"name": "Wien",
"results": [ ... ]
},
"election": {
"slug": "bpw16b",
"name": "BPW16 2. Wahlgang",
"results": [ ... ]
}
}
/{electionSlug}/{latitude},{longitude}
All–In–One – Searches for a district by latitude
and longitude
and returns the corresponding district results. Furthermore it returns the results for the parent state, specified by stateSlug
, and the results for the election, specified by electionSlug
.
NOTE The results
array format stays the same.
Response example: /bpw16b/48.014223,16.5558545
{
"district": {
"id": 75,
"name": "Götzendorf an der Leitha",
"results": [ ... ]
},
"state": {
"slug": "noe",
"name": "Niederösterreich",
"results": [ ... ]
},
"election": {
"slug": "bpw16b"
"name": "BPW16 2. Wahlgang",
"results": [ ... ]
}
}
The following routes return Content-Type: text/html
views using D3 for visualizing data.
/{electionSlug}/donut-chart
/{electionSlug}/{stateSlug}/donut-chart
(State Results Donut–Chart Visualization example coming soon ...)
/{electionSlug}/{stateSlug}/{districtId}/donut-chart
(District Results Donut–Chart Visualization example coming soon ...)
In order to use Google APIs, you have to add your own Server API key.
Go to the Google Developer Console
From the project drop-down, select an existing project, or create a new one by selecting Create a new project.
In the sidebar under "API Manager", select Credentials, then select the OAuth consent screen tab.
In the Credentials tab, select the New credentials drop-down list, and choose API key.
In the Create a new key dialog box select Server key.
Specify a Name for the Server key (e.g. "GeoWahl Server").
Finally press the Create button.
NOTE It may take up to 5 minutes for settings to take effect.
The following Google APIs have to be activated:
In the sidebar under "API Manager", select Google APIs, the search and select the afore mentioned APIs and press the Enable button.
In the sidebar under "API Manager", select Credentials, then copy your key from the API keys section.
Change the environment variable API_KEY
in your .env
file to your selected API key.
Austrian presidential elections (Bundespräsidentenwahlen 2016)
The results for all the federal states and communities from both ballots are available to the full extent !
Austrian representatives elections (Nationalratswahlen 2013)
The results for all the federal states and communities are available. Only the state Steiermark is missing, since they don't provide any useful .csv
files for their result. You are happily invited to add this !
Austrian local elections (Gemeinderatswahlen 2013)
The community results for the states Burgenland, Niederösterreich, Oberösterreich, Salzburg and Vienna are available. There is no data for the states Steiermark, Kärnten, Vorarlberg and Tirol.
Data errors should not be excluded, as all files have been curated to .json
format manually.
We assume no liability for possible mistakes !
The MIT License (MIT)
that's all folks