Skip to content

Commit

Permalink
Make the stops less pandemic, show bus interchanges at lower zoom levels
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeaun committed Nov 1, 2018
1 parent 4b4f877 commit cda35c3
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions assets/app.js
Expand Up @@ -300,12 +300,14 @@ class App extends Component {
stopsData[number] = { stopsData[number] = {
name, name,
number, number,
interchange: /\sint$/i.test(name) && !/^(bef|aft|opp|bet)\s/i.test(name),
coordinates: [lng, lat], coordinates: [lng, lat],
services: [], services: [],
routes: [], routes: [],
}; };
stopsDataArr.push(stopsData[number]); stopsDataArr.push(stopsData[number]);
}); });
stopsDataArr.sort((a, b) => a.interchange ? 1 : b.interchange ? -1 : 0);


Object.keys(servicesData).forEach(number => { Object.keys(servicesData).forEach(number => {
const { name, routes } = servicesData[number]; const { name, routes } = servicesData[number];
Expand Down Expand Up @@ -365,6 +367,7 @@ class App extends Component {
properties: { properties: {
number: stop.number, number: stop.number,
name: stop.name, name: stop.name,
interchange: stop.interchange,
}, },
geometry: { geometry: {
type: 'Point', type: 'Point',
Expand Down Expand Up @@ -411,22 +414,31 @@ class App extends Component {
type: 'symbol', type: 'symbol',
source: 'stops', source: 'stops',
layout: { layout: {
'symbol-z-order': 'source',
'icon-image': [ 'icon-image': [
'step', ['zoom'], 'step', ['zoom'],
'stop-small', ['case', ['get', 'interchange'], 'stop', 'stop-small'],
14, 'stop' 14, 'stop'
], ],
'icon-size': [ 'icon-size': [
'interpolate', ['linear'], ['zoom'], 'interpolate', ['linear'], ['zoom'],
10, .1, 10, ['case', ['get', 'interchange'], .4, .05],
15, .6 12, ['case', ['get', 'interchange'], .6, .05],
16, .6
], ],
'icon-padding': .5, 'icon-padding': .5,
'icon-allow-overlap': true, 'icon-allow-overlap': true,
// 'icon-ignore-placement': true, // 'icon-ignore-placement': true,
...stopText.layout, ...stopText.layout,
}, },
paint: stopText.paint, paint: {
'icon-opacity': [
'interpolate', ['linear'], ['zoom'],
8, 0,
9, 1,
],
...stopText.paint,
},
}, 'place-neighbourhood'); }, 'place-neighbourhood');


map.on('mouseenter', 'stops', () => { map.on('mouseenter', 'stops', () => {
Expand Down

0 comments on commit cda35c3

Please sign in to comment.