2016年澳大利亚大选的源代码可视化
See LICENSE for usage and distribution restrictions.
In 2016 there was a national election in Australia, this application was used to show the current state of the nation, where it was possible to vote, and once voting had closed the live results as they came in.
It consists of three main components:
A dart-based client (under dart_frontend). This is an Angular2 application
which uses a simple read-only HTTP API to get geospatial data combined with
Firebase to have real-time data and application state.
A go-based server (under go_backend). This was responsible for serving the
static geospatial data, as well as the physical locations of polling places.
It was also capable of computing the electorate for a given location.
[Not Included]: A utility that read various data sources (predominantly the
AEC) for the state of the election and pushed this data to Firebase. It is
possible to understand the Firebase schema readily from the running website
or from the firebase_service.
The live version of this website is visible at: https://ausvotes.withgoogle.com
You'll need:
Please also ensure you comply with the various [licenses] (./LICENSE).
To run the go backend locally:
make
./serveIf all the dependencies are met, make will create the dataset, build the go application and the dart frontend.
Access the local server at http://localhost:8090/.
To run the frontend client against an existing backend:
make
cd dart_frontend
pub serveAccess the local server at http://localhost:8080/.
You can edit [dart_frontend/lib/conf/config_debug.yaml] (dart_frontend/lib/conf/config_debug.yaml) to modify pub serve's backend.
To deploy to appengine, ensure the cloned project is associated with an appengine project (normally done via https://console.cloud.google.com/code/develop).
Once that's done, you should be able run make install.
The following REST requests show how the Go App Engine hosted API can be used to make queries against the shape data that is used to show electorates on the map.
Request:
/viewport/11?bbox=-12.73,130.83,-12.26,131.2Response:
…Note: For readability, allowEncodedPolylineFeatureCollection in [go_backend/http.go] (go_backend/http.go) was set to false for generating this output.
The application otherwise sends an encoded polyline JSON response, to reduce payload size.
The client can work with either formats.
Request:
/electorates/6?ids=lingiari,solomonResponse (truncated):
…This is not an official Google product
暂无开放 Issues,或尚未同步最近议题。