gtfs-to-html 2.3.5 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/lib/geojson-utils.js +6 -1
- package/package.json +9 -9
- package/public/css/timetable_styles.css +4 -16
- package/public/js/system-map.js +408 -80
- package/public/js/timetable-map.js +72 -27
- package/views/default/layout.pug +2 -1
- package/views/default/overview.pug +2 -2
- package/views/default/timetablepage.pug +1 -1
- package/www/docs/related-libraries.md +5 -0
- package/www/package.json +4 -4
- package/www/yarn.lock +1143 -1101
|
@@ -63,6 +63,10 @@ function getBounds(geojson) {
|
|
|
63
63
|
|
|
64
64
|
function createMap(id, geojson, routes) {
|
|
65
65
|
const defaultRouteColor = '#FF4728';
|
|
66
|
+
const lineLayout = {
|
|
67
|
+
'line-join': 'round',
|
|
68
|
+
'line-cap': 'round',
|
|
69
|
+
};
|
|
66
70
|
|
|
67
71
|
if (!geojson || geojson.features.length === 0) {
|
|
68
72
|
$('#map_' + id).hide();
|
|
@@ -92,6 +96,9 @@ function createMap(id, geojson, routes) {
|
|
|
92
96
|
duration: 0,
|
|
93
97
|
});
|
|
94
98
|
|
|
99
|
+
// Turn of Points of Interest labels
|
|
100
|
+
map.setLayoutProperty('poi-label', 'visibility', 'none');
|
|
101
|
+
|
|
95
102
|
// Find the index of the first symbol layer in the map style
|
|
96
103
|
let firstSymbolId;
|
|
97
104
|
for (const layer of map.getStyle().layers) {
|
|
@@ -101,7 +108,40 @@ function createMap(id, geojson, routes) {
|
|
|
101
108
|
}
|
|
102
109
|
}
|
|
103
110
|
|
|
104
|
-
// Add route
|
|
111
|
+
// Add route drop shadow outline first
|
|
112
|
+
map.addLayer(
|
|
113
|
+
{
|
|
114
|
+
id: 'route-line-shadow',
|
|
115
|
+
type: 'line',
|
|
116
|
+
source: {
|
|
117
|
+
type: 'geojson',
|
|
118
|
+
data: geojson,
|
|
119
|
+
},
|
|
120
|
+
paint: {
|
|
121
|
+
'line-color': '#000000',
|
|
122
|
+
'line-opacity': 0.3,
|
|
123
|
+
'line-width': {
|
|
124
|
+
base: 12,
|
|
125
|
+
stops: [
|
|
126
|
+
[14, 20],
|
|
127
|
+
[18, 42],
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
'line-blur': {
|
|
131
|
+
base: 12,
|
|
132
|
+
stops: [
|
|
133
|
+
[14, 20],
|
|
134
|
+
[18, 42],
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
layout: lineLayout,
|
|
139
|
+
filter: ['!has', 'stop_id'],
|
|
140
|
+
},
|
|
141
|
+
firstSymbolId
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
// Add route line outline
|
|
105
145
|
map.addLayer(
|
|
106
146
|
{
|
|
107
147
|
id: 'route-line-outline',
|
|
@@ -113,17 +153,21 @@ function createMap(id, geojson, routes) {
|
|
|
113
153
|
paint: {
|
|
114
154
|
'line-color': '#FFFFFF',
|
|
115
155
|
'line-opacity': 1,
|
|
116
|
-
'line-width':
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
156
|
+
'line-width': {
|
|
157
|
+
base: 8,
|
|
158
|
+
stops: [
|
|
159
|
+
[14, 12],
|
|
160
|
+
[18, 32],
|
|
161
|
+
],
|
|
162
|
+
},
|
|
121
163
|
},
|
|
164
|
+
layout: lineLayout,
|
|
122
165
|
filter: ['!has', 'stop_id'],
|
|
123
166
|
},
|
|
124
167
|
firstSymbolId
|
|
125
168
|
);
|
|
126
169
|
|
|
170
|
+
// Add route line
|
|
127
171
|
map.addLayer(
|
|
128
172
|
{
|
|
129
173
|
id: 'route-line',
|
|
@@ -135,17 +179,21 @@ function createMap(id, geojson, routes) {
|
|
|
135
179
|
paint: {
|
|
136
180
|
'line-color': ['to-color', ['get', 'route_color'], defaultRouteColor],
|
|
137
181
|
'line-opacity': 1,
|
|
138
|
-
'line-width':
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
182
|
+
'line-width': {
|
|
183
|
+
base: 4,
|
|
184
|
+
stops: [
|
|
185
|
+
[14, 6],
|
|
186
|
+
[18, 16],
|
|
187
|
+
],
|
|
188
|
+
},
|
|
143
189
|
},
|
|
190
|
+
layout: lineLayout,
|
|
144
191
|
filter: ['!has', 'stop_id'],
|
|
145
192
|
},
|
|
146
193
|
firstSymbolId
|
|
147
194
|
);
|
|
148
195
|
|
|
196
|
+
// Add stops
|
|
149
197
|
map.addLayer(
|
|
150
198
|
{
|
|
151
199
|
id: 'stops',
|
|
@@ -155,22 +203,23 @@ function createMap(id, geojson, routes) {
|
|
|
155
203
|
data: geojson,
|
|
156
204
|
},
|
|
157
205
|
paint: {
|
|
206
|
+
'circle-color': '#fff',
|
|
158
207
|
'circle-radius': {
|
|
208
|
+
base: 1.75,
|
|
159
209
|
stops: [
|
|
160
|
-
[
|
|
161
|
-
[
|
|
162
|
-
[15, 6],
|
|
210
|
+
[12, 4],
|
|
211
|
+
[22, 100],
|
|
163
212
|
],
|
|
164
213
|
},
|
|
165
|
-
'circle-stroke-
|
|
166
|
-
'circle-stroke-
|
|
167
|
-
'circle-color': '#363636',
|
|
214
|
+
'circle-stroke-color': '#3f4a5c',
|
|
215
|
+
'circle-stroke-width': 2,
|
|
168
216
|
},
|
|
169
217
|
filter: ['has', 'stop_id'],
|
|
170
218
|
},
|
|
171
219
|
firstSymbolId
|
|
172
220
|
);
|
|
173
221
|
|
|
222
|
+
// Layer for highlighted stops
|
|
174
223
|
map.addLayer(
|
|
175
224
|
{
|
|
176
225
|
id: 'stops-highlighted',
|
|
@@ -180,16 +229,16 @@ function createMap(id, geojson, routes) {
|
|
|
180
229
|
data: geojson,
|
|
181
230
|
},
|
|
182
231
|
paint: {
|
|
232
|
+
'circle-color': '#fff',
|
|
183
233
|
'circle-radius': {
|
|
234
|
+
base: 1.75,
|
|
184
235
|
stops: [
|
|
185
|
-
[
|
|
186
|
-
[
|
|
187
|
-
[15, 7],
|
|
236
|
+
[12, 5],
|
|
237
|
+
[22, 125],
|
|
188
238
|
],
|
|
189
239
|
},
|
|
190
240
|
'circle-stroke-width': 2,
|
|
191
|
-
'circle-stroke-color': '#
|
|
192
|
-
'circle-color': '#888888',
|
|
241
|
+
'circle-stroke-color': '#3f4a5c',
|
|
193
242
|
},
|
|
194
243
|
filter: ['==', 'stop_id', ''],
|
|
195
244
|
},
|
|
@@ -216,7 +265,7 @@ function createMap(id, geojson, routes) {
|
|
|
216
265
|
[event.point.x + 5, event.point.y + 5],
|
|
217
266
|
];
|
|
218
267
|
const features = map.queryRenderedFeatures(bbox, {
|
|
219
|
-
layers: ['stops'],
|
|
268
|
+
layers: ['stops-highlighted', 'stops'],
|
|
220
269
|
});
|
|
221
270
|
|
|
222
271
|
if (!features || features.length === 0) {
|
|
@@ -234,14 +283,10 @@ function createMap(id, geojson, routes) {
|
|
|
234
283
|
|
|
235
284
|
function highlightStop(stopId) {
|
|
236
285
|
map.setFilter('stops-highlighted', ['==', 'stop_id', stopId]);
|
|
237
|
-
map.setPaintProperty('stops', 'circle-opacity', 0.5);
|
|
238
|
-
map.setPaintProperty('stops', 'circle-stroke-opacity', 0.5);
|
|
239
286
|
}
|
|
240
287
|
|
|
241
288
|
function unHighlightStop() {
|
|
242
289
|
map.setFilter('stops-highlighted', ['==', 'stop_id', '']);
|
|
243
|
-
map.setPaintProperty('stops', 'circle-opacity', 1);
|
|
244
|
-
map.setPaintProperty('stops', 'circle-stroke-opacity', 1);
|
|
245
290
|
}
|
|
246
291
|
|
|
247
292
|
// On table hover, highlight stop on map
|
package/views/default/layout.pug
CHANGED
|
@@ -3,7 +3,6 @@ html
|
|
|
3
3
|
head
|
|
4
4
|
title= title
|
|
5
5
|
meta(charset="utf-8")
|
|
6
|
-
link(rel="stylesheet" href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" crossorigin="anonymous")
|
|
7
6
|
link(rel="stylesheet" href=`${config.assetPath}css/timetable_styles.css`)
|
|
8
7
|
if config.outputFormat === 'pdf'
|
|
9
8
|
link(rel="stylesheet" href=`${config.assetPath}css/timetable_pdf_styles.css`)
|
|
@@ -13,3 +12,5 @@ html
|
|
|
13
12
|
|
|
14
13
|
body
|
|
15
14
|
block content
|
|
15
|
+
|
|
16
|
+
script(src="https://cdn.tailwindcss.com")
|
|
@@ -10,13 +10,13 @@ include formatting_functions.pug
|
|
|
10
10
|
h1.text-2xl.pt-4.pb-2= `${formatAgencyName(timetablePageGroup.agency)} Routes`
|
|
11
11
|
each timetablePage in timetablePageGroup.timetablePages
|
|
12
12
|
if config.allowEmptyTimetables || timetablePage.consolidatedTimetables.length > 0
|
|
13
|
-
a.
|
|
13
|
+
a.block.p-2.border-b.border-slate-200(class="hover:bg-slate-200 hover:no-underline" href=`${timetablePage.relativePath}` data-route-ids=`${timetablePage.route_ids ? timetablePage.route_ids.join(',') : ''}`)
|
|
14
14
|
.text-lg.text-gray-800.leading-none= timetablePage.timetable_page_label
|
|
15
15
|
each route in _.uniqBy(_.flatMap(timetablePage.consolidatedTimetables, timetable => timetable.routes), 'route_id')
|
|
16
16
|
.flex.my-1
|
|
17
17
|
.route-color-swatch.flex-none.mr-2(style=`background-color: #${route.route_color}; color: #${route.route_text_color};`)= route.route_short_name || ''
|
|
18
18
|
.mt-1.text-gray-600.leading-none= formatRouteName(route)
|
|
19
|
-
.text-
|
|
19
|
+
.inline-flex.items-center.justify-center.px-2.py-1.text-xs.font-bold.leading-none.text-slate-800.bg-slate-200.rounded-full= timetablePage.dayList
|
|
20
20
|
if config.showMap
|
|
21
21
|
.map.ml-4.h-full.w-full(id="system_map")
|
|
22
22
|
|
|
@@ -14,7 +14,7 @@ include formatting_functions.pug
|
|
|
14
14
|
include timetable_menu.pug
|
|
15
15
|
|
|
16
16
|
each timetable in timetablePage.consolidatedTimetables
|
|
17
|
-
.timetable.mb-
|
|
17
|
+
.timetable.mb-10(id=`timetable_id_${formatHtmlId(timetable.timetable_id)}` data-day-list=timetable.dayList data-direction-name=timetable.direction_name data-timetable-id=timetable.timetable_id data-direction-id=timetable.direction_id data-route-id=timetable.route_ids.join('_'))
|
|
18
18
|
if config.showRouteTitle
|
|
19
19
|
h2.text-xl= `${timetable.timetable_label} | ${timetable.dayListLong}`
|
|
20
20
|
each note in getNotesForTimetableLabel(timetable.notes)
|
|
@@ -33,3 +33,8 @@ The [GTFS Text-to-Speech Tester](https://github.com/BlinkTagInc/node-gtfs-tts) i
|
|
|
33
33
|
|
|
34
34
|
[`https://github.com/BlinkTagInc/node-gtfs-tts`](https://github.com/BlinkTagInc/node-gtfs-tts)
|
|
35
35
|
|
|
36
|
+
## `node-gtfs-realtime`
|
|
37
|
+
|
|
38
|
+
[GTFS-realtime](https://developers.google.com/transit/gtfs-realtime) transit data is in [protobuf format](https://developers.google.com/protocol-buffers) which means its not human-readable by default. `node-GTFS-Realtime` aims to make it fast and easy to inspect GTFS-realtime data by providing a one-line command for downloading [GTFS-realtime format](https://developers.google.com/transit/gtfs-realtime) data and converting to JSON. Try it by running `npx gtfs-realtime http://api.bart.gov/gtfsrt/tripupdate.aspx` in your terminal.
|
|
39
|
+
|
|
40
|
+
[`https://github.com/BlinkTagInc/node-gtfs-realtime`](https://github.com/BlinkTagInc/node-gtfs-realtime)
|
package/www/package.json
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"deploy": "docusaurus deploy"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@docusaurus/core": "^2.0.0-beta.
|
|
13
|
-
"@docusaurus/preset-classic": "^2.0.0-beta.
|
|
12
|
+
"@docusaurus/core": "^2.0.0-beta.21",
|
|
13
|
+
"@docusaurus/preset-classic": "^2.0.0-beta.21",
|
|
14
14
|
"clsx": "^1.1.1",
|
|
15
|
-
"react": "^18.
|
|
16
|
-
"react-dom": "^18.
|
|
15
|
+
"react": "^18.1.0",
|
|
16
|
+
"react-dom": "^18.1.0"
|
|
17
17
|
},
|
|
18
18
|
"browserslist": {
|
|
19
19
|
"production": [
|