-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
158 lines (141 loc) · 5.88 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Swiss BFS Maps</title>
<meta charset="UTF-8"/>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/cosmo/bootstrap.min.css" rel="stylesheet">
<style>
path { fill: none; stroke: #888; stroke-width: .5px; }
.cantons { fill: #efefef; stroke: none; }
.canton-boundary { stroke-width: 1px; }
.land-boundary { stroke-width: 2px; }
.municipality-boundary { stroke: #aaa; }
.footer { padding: 30px 0; margin-top: 70px; border-top: 1px solid #e5e5e5; background-color: #f5f5f5; }
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="sgvizler.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://d3js.org/queue.v1.min.js"></script>
<script src="https://d3js.org/topojson.v0.min.js"></script>
<script type="text/javascript" src="maps.js"></script>
<script type="text/javascript">
sgvizler
.defaultEndpointURL("https://classifications.data.admin.ch/query/")
.defaultEndpointOutputFormat('xml')
.prefix('gz', 'http://data.admin.ch/vocab/')
.prefix('geo', 'http://www.w3.org/2003/01/geo/wgs84_pos#')
.prefix('dbp', 'http://dbpedia.org/resource/')
.prefix('xsd', 'http://www.w3.org/2001/XMLSchema#');
//// Leave this as is. Ready, steady, go!
$(document).ready(sgvizler.containerDrawAll);
</script>
</head>
<body>
<div class="container">
<h1>swissbfsmaps</h1>
<h2>Choropleth: Inhabitants per Municipality</h2>
<div id="municipalities1"
data-sgvizler-chart-options="domainmin=400|domainmax=300000|colormin=white|colormax=red"
data-sgvizler-query='
SELECT ?remuniid ?allnumber
WHERE
{
{
SELECT (SUM(?number) AS ?allnumber) ?remuniuri
WHERE
{
?s <http://data.admin.ch/bfs/property/NB_PERSON> ?number;
<http://data.admin.ch/bfs/property/REPORTINGMUNICIPALITYID> ?remuniuri;
<http://data.admin.ch/bfs/property/POPULATIONTYPE> ?ptype;
<http://data.admin.ch/bfs/property/HISTREPORTINGMUNICIPALITYID> ?muniuri.
?ptype <http://www.w3.org/2004/02/skos/core#notation> ?pnumber.
FILTER ((xsd:integer(?pnumber)) <= 2)
}
GROUP BY ?remuniuri
}
?remuniuri <http://www.w3.org/2004/02/skos/core#notation> ?remuniid.
}
LIMIT 10000
'
data-sgvizler-endpoint_output="json"
data-sgvizler-chart="sgvizler.visualization.swisschoropleth"
data-sgvizler-log="2"><p>loading ...</p></div>
<h2>Choropleth: Average Age per Municipality</h2>
<div id="municipalities2"
data-sgvizler-chart-options="domainmin=30|domainmax=50|colormin=white|colormax=darkred"
data-sgvizler-query='
SELECT ?remuniid (((FLOOR(?avgnew / ?numberall2 * 100)) / 100) AS ?allavg)
WHERE
{
{
SELECT (SUM(?numberall * ?ageamount) AS ?avgnew) (SUM(?numberall) AS ?numberall2) ?remuniuri
WHERE
{
SELECT (SUM(?number) AS ?numberall) ?remuniuri ?ageamount
WHERE
{
?s1 <http://data.admin.ch/bfs/property/NB_PERSON> ?number;
<http://data.admin.ch/bfs/property/REPORTINGMUNICIPALITYID> ?remuniuri;
<http://data.admin.ch/bfs/property/POPULATIONTYPE> ?ptype;
<http://data.admin.ch/bfs/property/AGE> ?age.
?age <http://www.w3.org/2004/02/skos/core#notation> ?agelit.
?ptype <http://www.w3.org/2004/02/skos/core#notation> ?pnumber.
FILTER ((xsd:integer(?pnumber)) <= 2)
BIND(xsd:integer(?agelit) AS ?ageamount)
}
GROUP BY ?remuniuri ?agelit ?ageamount
}
GROUP BY ?remuniuri
}
?remuniuri <http://www.w3.org/2004/02/skos/core#notation> ?remuniid.
}
'
data-sgvizler-endpoint_output="json"
data-sgvizler-chart="sgvizler.visualization.swisschoropleth"
data-sgvizler-log="2"><p>loading ...</p></div>
<h2>Choropleth: Female/Male Ratio per Municipality</h2>
<div id="municipalities3"
data-sgvizler-chart-options="domainmin=0.8|domainmax=1.2|colormin=blue|colormax=red"
data-sgvizler-query='
SELECT ?remuniid ?allnumber
WHERE
{
{
SELECT (((SUM(IF(?sex=<http://data.admin.ch/bfs/code/1.0/CL_SEX/2>,?number,0))) / (SUM(IF(?sex=<http://data.admin.ch/bfs/code/1.0/CL_SEX/1>,?number,0)))) AS ?allnumber) ?remuniuri
WHERE
{
?s <http://data.admin.ch/bfs/property/NB_PERSON> ?number;
<http://data.admin.ch/bfs/property/REPORTINGMUNICIPALITYID> ?remuniuri;
<http://data.admin.ch/bfs/property/SEX> ?sex;
<http://data.admin.ch/bfs/property/POPULATIONTYPE> ?ptype;
<http://data.admin.ch/bfs/property/HISTREPORTINGMUNICIPALITYID> ?muniuri.
?ptype <http://www.w3.org/2004/02/skos/core#notation> ?pnumber.
FILTER ((xsd:integer(?pnumber)) <= 2)
}
GROUP BY ?remuniuri
}
?remuniuri <http://www.w3.org/2004/02/skos/core#notation> ?remuniid.
}
LIMIT 10000
'
data-sgvizler-endpoint_output="json"
data-sgvizler-chart="sgvizler.visualization.swisschoropleth"
data-sgvizler-log="2"><p>loading ...</p></div>
</div>
<!-- Please leave a link to the Sgvizler homepage -->
<footer class="footer">
<div class="container">
<p>Powered by:<small>
<ul>
<li><a href="http://sgvizler.googlecode.com/">Sgvizler</a> © 2011 Martin G. Skjæveland. </li>
<li><a href="http://twitter.github.com/bootstrap/">Bootstrap</a></li>
<li><a href="http://d3js.org/">d3.js</a> © 2012 Michael Bostock</li>
</ul>
</small></p>
</div>
</footer>
</body>
</html>