-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathmarkers.html
47 lines (47 loc) · 1.23 KB
/
markers.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
---
layout: default
---
<h3>Pueblos with markers in centroids.</h3>
<div id = 'pueblos-map'>
<script type = 'text/javascript'>
// change the argument to match your id
var node = document.getElementById("pueblos-map");
function after_loading(atlas){
var centroids = [];
atlas.data.pueblos.features.forEach(function(pueblo){
var centroid = d3.geo.centroid(pueblo);
centroids.push({center: centroid, text: pueblo.properties.NAME});
});
atlas.add_markers(centroids);
};
var config = {
node: node,
tiles: 'pueblos',
size: "large",
on_ready: after_loading
};
new AtlasPR(config);
</script>
<div id = "code">
{% highlight js linenos %}
// change the argument to match your id
var node = document.getElementById("pueblos-map");
function after_loading(atlas){
var centroids = [];
atlas.data.pueblos.features.forEach(function(pueblo){
var centroid = d3.geo.centroid(pueblo);
centroids.push({center: centroid, text: pueblo.properties.NAME});
});
atlas.add_markers(centroids);
};
var config = {
node: node,
tiles: 'pueblos',
size: "large",
zoom: true,
on_ready: after_loading
};
new AtlasPR(config);
{% endhighlight %}
</div>
</div>