Skip to content

Commit

Permalink
New 2018
Browse files Browse the repository at this point in the history
  • Loading branch information
olivernyc committed Aug 5, 2018
1 parent f7c775d commit 74546cb
Show file tree
Hide file tree
Showing 6 changed files with 871 additions and 56 deletions.
28 changes: 21 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,27 @@
</head>

<body>
<main class="ph4">
<div class="vh-100 w-100 pa5">
<div id="map-div-1" class="w-100 h-100 relative bg-light-gray "></div>
</div>
<div class="vh-100 w-100 pa5">
<div id="map-div-2" class="w-100 h-100 relative bg-light-gray "></div>
</div>
<main class="pa3 mw8 center sans-serif">
<div class="mv5 pa3 w-100">
<h1 class="tc f4 fw8">January 2018</h1>
<div class="w-100 vh-75">
<div id="map-div-1" class="w-100 h-100 relative bg-light-gray "></div>
</div>
</div>

<div class="mv5 pa3 w-100">
<h1 class="tc f4 fw8">August 2018</h1>
<div class="w-100 vh-75">
<div id="map-div-2" class="w-100 h-100 relative bg-light-gray "></div>
</div>
</div>

<div class="mv5 pa3 w-100">
<h1 class="tc f4 fw8">New 2018</h1>
<div class="w-100 vh-75">
<div id="map-div-3" class="w-100 h-100 relative bg-light-gray "></div>
</div>
</div>
</main>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBNClp7oJsw-eleEoR3-PQKV23tpeW-FpE&libraries=visualization&callback=initMap" async defer></script>
<script src="/map.js"></script>
Expand Down
71 changes: 23 additions & 48 deletions map.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const maps = [
divId: "map-div-1",
jsonPaths: {
active: "/nodes/active-jan-18.json",
potential: "/nodes/potential-jan-18.json",
links: "/nodes/links-jan-18.json"
},
sectors: [
Expand All @@ -31,7 +30,6 @@ const maps = [
divId: "map-div-2",
jsonPaths: {
active: "/nodes/active.json",
potential: "/nodes/potential.json",
links: "/nodes/links.json"
},
sectors: [
Expand All @@ -57,6 +55,22 @@ const maps = [
width: 360
}
]
},
{
divId: "map-div-3",
jsonPaths: {
active: "/nodes/active-new-18.json",
links: "/nodes/links-new-18.json"
},
sectors: [
{
lat: 40.685823,
lng: -73.917272,
r: 2,
azimuth: 180,
width: 360
}
]
}
];

Expand Down Expand Up @@ -134,22 +148,14 @@ const styles = [
}
]
}
// {
// featureType: "water",
// elementType: "labels.text.fill",
// stylers: [
// {
// color: "#777777"
// }
// ]
// }
];

const mapOptions = {
center: { lat: 40.6981809, lng: -73.9595798 },
zoom: 13,
disableDefaultUI: false,
zoomControl: false,
streetViewControl: false,
scrollwheel: false,
scrollwheel: false,
fullscreenControl: false,
Expand All @@ -176,8 +182,6 @@ function initMapWithData(map) {
// Load data
var activeNodesLayer = new google.maps.Data();
activeNodesLayer.loadGeoJson(jsonPaths.active);
var potentialNodesLayer = new google.maps.Data();
potentialNodesLayer.loadGeoJson(jsonPaths.potential);
var linksLayer = new google.maps.Data();
linksLayer.loadGeoJson(jsonPaths.links);

Expand All @@ -198,7 +202,8 @@ function initMapWithData(map) {
// Set layer styles
activeNodesLayer.setStyle(function(feature) {
var url = "/img/map/active.svg";
var opacity = 1;
const install_year = feature.getProperty("install_year");
var opacity = install_year ? (install_year == 2018 ? 1 : 0.25) : 1;
var visible = true;
var rotation = 0;
var notes = feature.getProperty("notes").toLowerCase();
Expand All @@ -215,52 +220,23 @@ function initMapWithData(map) {
url: url,
anchor: new google.maps.Point(10, 10),
labelOrigin: new google.maps.Point(28, 10),
rotation: rotation,
scale: 0.5
}
};
});

potentialNodesLayer.setStyle(function(feature) {
var url = "/img/map/potential.svg";
var opacity = 1;
var visible = true;
var notes = feature.getProperty("notes").toLowerCase();
if (notes.indexOf("supernode") !== -1) {
url = "/img/map/supernode-potential.svg";
}

return {
title: feature.getProperty("id"),
opacity: opacity,
zIndex: 100,
visible: visible,
icon: {
url: url,
anchor: new google.maps.Point(10, 10),
labelOrigin: new google.maps.Point(28, 10)
}
};
});

linksLayer.setStyle(function(link) {
var strokeColor = "#ff3b30";
var opacity = 0.5;
var visible = true;

const install_year = link.getProperty("install_year");
var opacity = install_year ? (install_year == 2018 ? 1 : 0.25) : 1;

if (link.getProperty("status") != "active") {
strokeColor = "gray";
opacity = 0;
}

if (searchQuery.length > 0) {
var linkMatches =
matchesSearch(searchQuery, link.getProperty("from")) ||
matchesSearch(searchQuery, link.getProperty("to"));
if (!linkMatches) visible = false;
}

return {
visible: visible,
zIndex: 999,
strokeWeight: 3,
strokeColor: strokeColor,
Expand All @@ -270,7 +246,6 @@ function initMapWithData(map) {

// Add layers to map
linksLayer.setMap(map);
// potentialNodesLayer.setMap(map);
activeNodesLayer.setMap(map);
}

Expand Down
1 change: 1 addition & 0 deletions nodes/active-new-18.json

Large diffs are not rendered by default.

Loading

0 comments on commit 74546cb

Please sign in to comment.