Skip to content

Commit 7799249

Browse files
author
critzo
authored
Add siteinfo based status map (#506)
* started modifying the status page to use a leaflet map; removed link to neubot central server that is now offline * start at converting status map to use open tiles & siteinfo * WIP - basic mapbox replacement for status map * WIP - clustered version of status map * trying to get props of cluster children * update new status map with basic clusters, show props of cluster leaves * style cluster css * make popups show/hide on hover, not click * switching back to show/hide on click, removed cluster zoom on click * replaced local copy of sitegeo.json with updated copy in GCS * updates per reviewer's comments * added local sitegeo file for previewing to avoid cors issues. will change on final commit before merging after review session2 * add missing semi-colon * add notes on using the infrastructure map * update url for siteinfo data
1 parent c2bffe3 commit 7799249

File tree

8 files changed

+2949
-15
lines changed

8 files changed

+2949
-15
lines changed

_includes/head.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@
3333
<!-- Styles -->
3434
<link href="{{ site.baseurl }}/css/base.css" rel="stylesheet" />
3535

36-
{% if page.audience == "observatory" %}
37-
<!-- Observatory page styles -->
38-
<link rel="stylesheet" href="{{ site.baseurl }}/mlab_observatory/static/js/observatory/vendor/bootstrap/bootstrap.min.css" />
39-
<link rel="stylesheet" href="{{ site.baseurl }}/mlab_observatory/static/js/observatory/vendor/bootstrap/bootstrap-theme.css" />
40-
<link rel="stylesheet" href="{{ site.baseurl }}/mlab_observatory/static/js/observatory/vendor/bootstrap/bootstrap-select.min.css" />
41-
<link rel="stylesheet" href="{{ site.baseurl }}/mlab_observatory/static/css/observatory/mlabOpenInternet.css" />
36+
{% if page.audience == "statusmap" %}
37+
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=yes' />
38+
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.2.0/mapbox-gl.js'></script>
39+
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.2.0/mapbox-gl.css' rel='stylesheet' />
40+
<link rel="stylesheet" href="{{ site.baseurl }}/css/mapbox.css"/>
4241
{% endif %}
4342

4443
<!-- JS Libs -->

_includes/infrastructure-map.js

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<script>
2+
mapboxgl.accessToken = 'pk.eyJ1IjoibS1sYWIiLCJhIjoiY2p3eWtxOXZ4MDFkMzQ5cG95ODFhbWJieiJ9.9G1YGnkme4goR0Ly3kqovA';
3+
var map = new mapboxgl.Map({
4+
container: 'map',
5+
style: 'mapbox://styles/mapbox/dark-v10',
6+
center: [12,25],
7+
zoom: 0.8
8+
});
9+
10+
var url = 'https://siteinfo.mlab-oti.measurementlab.net/v1/sites/geo.json';
11+
12+
map.on('load', function () {
13+
14+
const tenG = ['==', ['get','uplink'], '10g'];
15+
const oneG = ['==', ['get','uplink'], '1g'];
16+
17+
map.addSource("mlab-sites", {
18+
type: "geojson",
19+
data: url,
20+
cluster: true,
21+
clusterRadius: 10,
22+
clusterMaxZoom: 15,
23+
clusterProperties: {
24+
'oneG': ['+', ['case', oneG, 1, 0]],
25+
'tenG': ['+', ['case', tenG, 1, 0]],
26+
}
27+
});
28+
map.addLayer({
29+
"id": "clusters",
30+
"type": "circle",
31+
"source": "mlab-sites",
32+
"filter": ["has", "point_count"],
33+
"paint": {
34+
"circle-radius": [
35+
"step",
36+
["get", "point_count"],
37+
5,
38+
2,
39+
10,
40+
6,
41+
15
42+
],
43+
"circle-color": [
44+
"step",
45+
["get","point_count"],
46+
"#deebf7",
47+
2,
48+
"#9ecae1",
49+
6,
50+
"#3182bd"
51+
]}
52+
});
53+
map.addLayer({
54+
"id": "cluster-count",
55+
"type": "symbol",
56+
"source": "mlab-sites",
57+
"filter": ["has", "point_count"],
58+
"layout": {
59+
"text-field": "{point_count_abbreviated}",
60+
"text-font": ["DIN Offc Pro Medium",
61+
"Arial Unicode MS Bold"],
62+
"text-size": 12
63+
}
64+
});
65+
map.addLayer({
66+
"id": "unclustered-point",
67+
"type": "circle",
68+
"source": "mlab-sites",
69+
"filter": ["!", ["has", "point_count"]],
70+
"paint": {
71+
"circle-radius": 5,
72+
"circle-color": "#deebf7",
73+
"circle-stroke-width": 1,
74+
"circle-stroke-color": "#000"
75+
}
76+
});
77+
78+
var clusterPopup = new mapboxgl.Popup({
79+
className: 'cluster-popup'
80+
});
81+
var pointPopup = new mapboxgl.Popup({
82+
className: 'point-popup'
83+
});
84+
85+
map.on('click','clusters', function(e) {
86+
var features = map.queryRenderedFeatures(e.point, { layers: ['clusters'] });
87+
var clusterId = features[0].properties.cluster_id,
88+
point_count = features[0].properties.point_count,
89+
clusterSource = map.getSource('mlab-sites');
90+
clusterNodes = clusterSource.getClusterLeaves(clusterId, point_count, 0, function(err, aFeatures){
91+
var desc = "";
92+
for (c=0; c < aFeatures.length; c++) {
93+
desc += "<div class='pod-popup'><h4>"+aFeatures[c].properties.city+" - "+
94+
aFeatures[c].properties.name+" - "+aFeatures[c].properties.uplink+"</h4>"+
95+
aFeatures[c].properties.provider + " ("+aFeatures[c].properties.asn+")<br>"+
96+
"IPv4 Prefix: "+aFeatures[c].properties.ipv4_prefix;
97+
if (aFeatures[c].properties.ipv6_prefix != null) {
98+
desc += "<br>IPv6 Prefix: "+aFeatures[c].properties.ipv6_prefix;
99+
}
100+
desc += "</div>";
101+
}
102+
var coordinates = e.lngLat;
103+
while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
104+
coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;
105+
}
106+
clusterPopup.setLngLat(coordinates).setHTML(desc).addTo(map);
107+
});
108+
});
109+
110+
map.on('click','unclustered-point', function(e) {
111+
var coordinates = e.features[0].geometry.coordinates.slice();
112+
var description = "<h4>" + e.features[0].properties.city + " - " +
113+
e.features[0].properties.name + " - "+ e.features[0].properties.uplink +"</h4>" +
114+
e.features[0].properties.provider + " ("+e.features[0].properties.asn + ")<br>" +
115+
"IPv4 Prefix: " + e.features[0].properties.ipv4_prefix;
116+
if (e.features[0].properties.ipv6_prefix != null ) {
117+
description += "<br>IPv6 Prefix: " + e.features[0].properties.ipv6_prefix;
118+
}
119+
120+
while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
121+
coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;
122+
}
123+
pointPopup.setLngLat(coordinates).setHTML(description).addTo(map);
124+
});
125+
126+
map.on('mouseenter','clusters', function (e) {
127+
map.getCanvas().style.cursor = 'pointer';
128+
});
129+
map.on('mouseleave','clusters', function () {
130+
map.getCanvas().style.cursor = '';
131+
});
132+
map.on('mouseenter','unclustered-point', function (e) {
133+
map.getCanvas().style.cursor = 'pointer';
134+
});
135+
map.on('mouseleave','unclustered-point', function () {
136+
map.getCanvas().style.cursor = '';
137+
});
138+
});
139+
</script>

_pages/06-publications.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ This article investigates how infrastructure competition among broadband network
134134
{:.paper-author}
135135
Reza Rajabiun, Catherine Middleton
136136

137-
[Download](http://www.sciencedirect.com/science/article/pii/S0308596117301143){:.download-link .paper-download target="_blank"}
137+
[Download](https://doi.org/10.1016/j.telpol.2017.08.001){:.download-link .paper-download target="_blank"}
138138

139139
### Regulatory Federalism and Broadband Divergence: Implications of Invoking Europe in the Making of Canadian Telecom Policy
140140
{:.no_toc}

_pages/datatools.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ Community tools are developed by other organizations or individuals, but which l
2626
* [I3 Connectivity Explorer](https://i3cex.internet-is-infrastructure.org/){:target="_blank"} - Part of the [Internet as Infrastructure Project](https://internet-is-infrastructure.org/){:target="_blank"}, "_I3 Connectivity Explorer pulls data from U.S. Government agencies — FCC, Census, EPA, USDA — and public sources including the Measurement Lab and the Pro Publica Congress API. It then combines the sources across the places we live: towns, counties and county subdivisions, tribal regions, school and congressional districts; and presents the data in both graphical (maps and charts) and tabular formats using multiple resolutions: block, block group, tract, county, and state._"
2727
* [Piecewise](https://github.com/opentechinstitute/piecewise){:target="_blank"} - _Piecewise_ is a tool for digesting and aggregating user-volunteered Internet performance test results data from Measurement Lab, and visualizing aggregate data on the web.
2828
* [Michigan](https://mi.broadbandtest.us/){:target="_blank"}
29-
* [Pennsylvania](https://pa.broadbandtest.us/){:target="_blank"}
30-
* [Ferry County, WA](https://ferrycountybroadband.com/){:target="_blank"}
3129
* [Speedup America](https://github.com/Hack4Eugene/SpeedUpAmerica){:target=:"_blank"} - _Speed Up America's_ project vision is an open source nation-wide map that pulls individual internet speed test data from M-Lab and breaking down the results on maps and charts by points, census blocks, ISP, date range, and speed. Census block data and FCC 477 data will used to supplement both the analysis and maps.
3230

3331
## M-Lab Integrations

_pages/status.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
layout: page
33
permalink: /status/
44
title: "M-Lab Platform Status"
5+
audience: statusmap
56
breadcrumb: data
67
---
78

89
# M-Lab Platform Status
910

10-
M-Lab places server infrastructure for conductingt tests in diverse location around the world. Typically we seek hosting in well connected data centers where ISPs interconnect with one another. Each M-Lab "pod" consists of 3-4 servers and one switch, connected directly to an upstream provider. In large metro areas, we attempt to place multiple pods to obtain diversity in transit and routes.
11+
M-Lab places server infrastructure for conducting tests in diverse location around the world. Typically we seek hosting in well connected data centers where ISPs interconnect with one another. Each M-Lab "pod" consists of 3-4 servers and one switch, connected directly to an upstream provider. In large metro areas, we attempt to place multiple pods to obtain diversity in transit and routes.
1112

1213
## Infrastructure Map
14+
<p>
15+
The M-Lab infrastructure map displays information about our server pods around the world. Clusters of M-Lab pods are displayed as dark-blue and light-blue circles with a count of pods in the center. Clicking on a cluster will display a pop up with info about each pod in the cluster. Single small dots show locations with only one server. Clicking on a single pod will display a pop up with info about that pod. Double-click on the map to zoom in, or scroll in and out to zoom.
16+
<div id="map" class="map leaflet-container" style="height: 500px; width:100%; position:relative;"></div>
17+
</p>
1318

14-
<p><iframe src="https://mlab-ns.appspot.com/admin/map/ipv4/all" width="100%" height="660" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" align="left"></iframe></p>
15-
16-
## Server Status
17-
18-
<p><iframe src="https://mlab-ns.appspot.com/admin/sliver_tools" width="100%" height="400" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes"></iframe></p>
19+
{% include infrastructure-map.js %}
1920

2021
## M-Lab Naming Service
2122

css/mapbox.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
div.pod-popup {
2+
width: 175px;
3+
display: block;
4+
float: left;
5+
padding: 5px;
6+
7+
}
8+
.cluster-popup {
9+
width: 400px;
10+
}
11+
.cluster-popup div.mapboxgl-popup-content {
12+
13+
}
14+
div.mapboxgl-popup-content {
15+
max-width: 400px;
16+
max-height: 200px;
17+
overflow-y: scroll;
18+
overflow-x: scroll;
19+
background: rgba(255,255,255,0.85);
20+
border-radius: 10px;
21+
color: black;
22+
}
23+
div.mapboxgl-popup-content h4 {
24+
font-weight: bold;
25+
font-size: 1.2em;
26+
color: black;
27+
}

js/libs/leaflet.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)