-
Notifications
You must be signed in to change notification settings - Fork 20
/
poverty.html
42 lines (41 loc) · 1.46 KB
/
poverty.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
---
layout: default
---
<h2>Examples<small>Barrios maps (<a href = "https://github.com/miguelrios/atlaspr/blob/master/examples/barrios.html">source code</a>)</small></h2>
<h3>Barrios - % of families under poverty level</h3>
<div id = 'pobreza-map'>
</div>
<script type = 'text/javascript'>
var node = document.getElementById("pobreza-map");
d3.json("data/barriosdata.json", function(data){
var pob_datamap = {};
data.forEach(function(barrio){
if(barrio.below_poverty != null){
// get tile id from metadata GEO_ID, last 5 chars from 19.
pob_datamap[barrio.geo_id.substring(14)] = barrio.below_poverty;
}
});
var pop_map = new AtlasPR({node: node, tiles: 'barrios', size: "large", on_ready: function(){
// this needs to be called after drawing the map.
pop_map.encode_quan(pob_datamap);
}});
});
</script>
<div id = "code">
{% highlight js linenos %}
var node = document.getElementById("pobreza-map");
d3.json("data/barriosdata.json", function(data){
var pob_datamap = {};
data.forEach(function(barrio){
if(barrio.below_poverty != null){
// get tile id from metadata GEO_ID, last 5 chars from 19.
pob_datamap[barrio.geo_id.substring(14)] = barrio.below_poverty;
}
});
var pop_map = new AtlasPR({node: node, tiles: 'barrios', size: "large", on_ready: function(){
// this needs to be called after drawing the map.
pop_map.encode_quan(pob_datamap);
}});
});
{% endhighlight %}
</div>