Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ timezone is logged once at startup.

- `netex:update` downloads NeTEx packages configured in a router's `netex` list and copies them, renamed to `<id>-netex.zip`, to the `data/ready/netex` directory. Unlike `gtfs:update`, this data is not fitted, filtered, or otherwise processed — it is only downloaded and renamed.

- `taxiZone:update` downloads GTFS packages configured in a router's `taxiZone` list (separate from the regular `gtfs` list, used for OpenTripPlanner's taxi zone feature) and copies them, renamed to `<id>-taxizone.zip`, to the `data/ready/taxizone` directory. Works the same way as `netex:update` above.
- `router:copy`/`router:copyForPrebuiltStreetGraphDataBuild` (via `PrepareRouterData.js`) write the router's `build-config.json`. Every configured `gtfs` and `netex` feed is listed explicitly in its `transitFeeds` array (with `feedId`/`source`, and `taxiProvider: true` for taxi provider feeds). This is required because OTP disables local directory auto-scanning for an entire feed type (`gtfs` or `netex`) as soon as any feed of that type is declared in `transitFeeds` — a partial/mixed list would cause the undeclared feeds of that type to be silently dropped.

- `router:buildGraph`

Expand Down Expand Up @@ -152,15 +152,14 @@ timezone is logged once at startup.
- `gtfs:filter`
- `gtfs:id`
5. `netex:update`
6. `taxiZone:update`
7. `router:buildGraph`
6. `router:buildGraph`
- `router:copy`
- `buildOTPGraphTask(config.router)`
8. `test.sh`
9. `router:store`
10. `deploy.sh`
11. `deploy-otp.sh`
12. `storage:cleanup`
7. `test.sh`
8. `router:store`
9. `deploy.sh`
10. `deploy-otp.sh`
11. `storage:cleanup`

#### Street only build

Expand All @@ -182,15 +181,14 @@ timezone is logged once at startup.
- `gtfs:filter`
- `gtfs:id`
3. `netex:update`
4. `taxiZone:update`
5. `router:buildWithPrebuiltStreetGraph`
4. `router:buildWithPrebuiltStreetGraph`
- `router:copyForPrebuiltStreetGraphDataBuild`
- `buildOTPGraphTask(config.router)`
6. `test.sh`
7. `router:storeForPrebuiltStreetGraphDataBuild`
8. `deploy.sh`
9. `deploy-otp.sh`
10. `storage:cleanup`
5. `test.sh`
6. `router:storeForPrebuiltStreetGraphDataBuild`
7. `deploy.sh`
8. `deploy-otp.sh`
9. `storage:cleanup`

### otp-data-tools

Expand Down
15 changes: 9 additions & 6 deletions configs/finland/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,15 @@ module.exports = {
'https://minfoapi.matkahuolto.fi/gtfs/177/gtfs.zip',
true,
),
],
taxiZone: [
{
id: '02Taksi',
url: 'https://gtfsdata.blob.core.windows.net/finland/02Taksi-taxizone.zip',
},
mapSrc(
'02Taksi',
'https://gtfsdata.blob.core.windows.net/finland/02Taksi-taxizone.zip',
undefined,
undefined,
undefined,
undefined,
true,
),
],
netex: [
{
Expand Down
2 changes: 1 addition & 1 deletion configs/finland/otp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"Emission": true,
"DebugRasterTiles": true,
"FlexRouting": true,
"TaxiZone": true
"TaxiRouting": true
}
}
15 changes: 9 additions & 6 deletions configs/varely/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ module.exports = {
),
mapSrc('Salo', 'https://tvv.fra1.digitaloceanspaces.com/239.zip', true),
mapSrc('Pori', 'https://tvv.fra1.digitaloceanspaces.com/231.zip', true),
],
taxiZone: [
{
id: '02Taksi',
url: 'https://gtfsdata.blob.core.windows.net/finland/02Taksi-taxizone.zip',
},
mapSrc(
'02Taksi',
'https://gtfsdata.blob.core.windows.net/finland/02Taksi-taxizone.zip',
undefined,
undefined,
undefined,
undefined,
true,
),
],
osm: ['varely'],
};
2 changes: 1 addition & 1 deletion configs/varely/otp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"ActuatorAPI": true,
"AsyncGraphQLFetchers": false,
"DebugRasterTiles": true,
"TaxiZone": true
"TaxiRouting": true
}
}
15 changes: 9 additions & 6 deletions configs/waltti-alt/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ module.exports = {
'https://github.com/tvv-lippu-ja-maksujarjestelma-oy/waltti-digitransit-config-data/raw/refs/heads/main/GTFStestireittiopas.zip',
'true',
),
],
taxiZone: [
{
id: '02Taksi',
url: 'https://gtfsdata.blob.core.windows.net/finland/02Taksi-taxizone.zip',
},
mapSrc(
'02Taksi',
'https://gtfsdata.blob.core.windows.net/finland/02Taksi-taxizone.zip',
undefined,
undefined,
undefined,
undefined,
true,
),
],
osm: ['oulu', 'southFinland'],
};
2 changes: 1 addition & 1 deletion configs/waltti-alt/otp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"ActuatorAPI": true,
"AsyncGraphQLFetchers": false,
"DebugRasterTiles": true,
"TaxiZone": true
"TaxiRouting": true
}
}
15 changes: 9 additions & 6 deletions configs/waltti/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,15 @@ module.exports = {
),
mapSrc('Salo', 'https://tvv.fra1.digitaloceanspaces.com/239.zip', true),
mapSrc('Kajaani', 'https://tvv.fra1.digitaloceanspaces.com/211.zip', true),
],
taxiZone: [
{
id: '02Taksi',
url: 'https://gtfsdata.blob.core.windows.net/finland/02Taksi-taxizone.zip',
},
mapSrc(
'02Taksi',
'https://gtfsdata.blob.core.windows.net/finland/02Taksi-taxizone.zip',
undefined,
undefined,
undefined,
undefined,
true,
),
],
osm: ['kajaani', 'oulu', 'rovaniemi', 'southFinland', 'vaasa'],
};
2 changes: 1 addition & 1 deletion configs/waltti/otp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"AsyncGraphQLFetchers": false,
"Emission": true,
"DebugRasterTiles": true,
"TaxiZone": true
"TaxiRouting": true
}
}
44 changes: 0 additions & 44 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,11 @@ const osmDlDir = `${config.dataDir}/downloads/osm`;
const demDlDir = `${config.dataDir}/downloads/dem`;
const gtfsDlDir = `${config.dataDir}/downloads/gtfs`;
const netexDlDir = `${config.dataDir}/downloads/netex`;
const taxiZoneDlDir = `${config.dataDir}/downloads/taxizone`;

const osmDir = `${config.dataDir}/ready/osm`;
const demDir = `${config.dataDir}/ready/dem`;
const gtfsDir = `${config.dataDir}/ready/gtfs`;
const netexDir = `${config.dataDir}/ready/netex`;
const taxiZoneDir = `${config.dataDir}/ready/taxizone`;

const gtfsSeedDir = `${config.dataDir}/seed`;
const fitDir = `${config.dataDir}/fit`;
Expand Down Expand Up @@ -108,29 +106,6 @@ gulp.task('netex:rename', () =>

gulp.task('netex:update', gulp.series('netex:download', 'netex:rename'));

/**
* Download taxi zone data
*/
gulp.task('taxiZone:download', () => {
if (!config.router.taxiZone) {
return Promise.resolve();
}
return dl(config.router.taxiZone, taxiZoneDlDir);
});

gulp.task('taxiZone:rename', () =>
pipeline(
gulp.src(`${taxiZoneDlDir}/*`, noBuf),
renameFile('-taxizone'),
gulp.dest(taxiZoneDir),
),
);

gulp.task(
'taxiZone:update',
gulp.series('taxiZone:download', 'taxiZone:rename'),
);

/**
* Download osm data
*/
Expand Down Expand Up @@ -366,24 +341,6 @@ gulp.task(
),
);

gulp.task('taxiZone:del', () => {
logger.info('Deleting old taxi zone data...');
return del(taxiZoneDir);
});

gulp.task(
'taxiZone:seed',
gulp.series(
'taxiZone:del',
named('taxiZone:seed:copyFiles', () =>
pipeline(
gulp.src(`${seedSourceDir}/*-taxizone.zip`, noBuf),
gulp.dest(taxiZoneDir),
),
),
),
);

gulp.task('osm:del', () => {
logger.info('Deleting old OSM data...');
return del(osmDir);
Expand Down Expand Up @@ -438,7 +395,6 @@ gulp.task(
'osm:seed',
'gtfs:seed',
'netex:seed',
'taxiZone:seed',
'seed:cleanup',
),
);
Expand Down
1 change: 0 additions & 1 deletion src/tasks/BuildOTPGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ const packData = function (commit, router) {
`${path}/router-${router.id}.zip`,
[
`${path}/*-gtfs.zip`,
`${path}/*-taxizone.zip`,
`${path}/*-netex.zip`,
`${path}/*.json`,
...osmFiles,
Expand Down
29 changes: 20 additions & 9 deletions src/tasks/PrepareRouterData.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ const extraUpdaters =
? JSON.parse(process.env.EXTRA_UPDATERS)
: {};

/**
* Builds the `transitFeeds` array for build-config.json. Every configured gtfs and netex
* feed must be listed explicitly here: OTP disables local directory auto-scanning for an
* entire feed type (gtfs or netex) as soon as one feed of that type is declared, so a
* partial list would silently drop any undeclared feeds of that type.
*/
function createAndProcessBuildConfig(router) {
logger.info('Creating build-config.json...');
const configName = `${configsDir}/${router.id}/build-config.json`;
Expand All @@ -39,17 +45,22 @@ function createAndProcessBuildConfig(router) {
};
transitFeeds.push(feed);
});
buildConfig.transitFeeds = transitFeeds;
}
if (router.taxiZone) {
const taxiZoneFeeds = buildConfig.taxiZone?.feeds || [];
router.taxiZone.forEach(src => {
taxiZoneFeeds.push({
if (router.gtfs) {
router.gtfs.forEach(src => {
const feed = {
type: 'gtfs',
feedId: src.id,
source: 'file:///var/opentripplanner/' + src.id + '-taxizone.zip',
});
source: 'file:///var/opentripplanner/' + src.id + '-gtfs.zip',
};
if (src.taxiProvider) {
feed.taxiProvider = true;
}
transitFeeds.push(feed);
});
buildConfig.taxiZone = { ...buildConfig.taxiZone, feeds: taxiZoneFeeds };
}
if (transitFeeds.length > 0) {
buildConfig.transitFeeds = transitFeeds;
}
const file = new Vinyl({
path: 'build-config.json',
Expand Down Expand Up @@ -95,7 +106,7 @@ function createAndProcessRouterConfig(router) {

function getTransitDataFiles(router) {
const files = [];
['gtfs', 'netex', 'taxiZone'].forEach(type => {
['gtfs', 'netex'].forEach(type => {
if (router[type]) {
const dirName = type.toLowerCase();
router[type].forEach(src => {
Expand Down
1 change: 0 additions & 1 deletion src/tasks/Update.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ async function handleOsmAndDemUpdate() {
async function handleTransitDataUpdate() {
await start('gtfs:update');
await start('netex:update');
await start('taxiZone:update');
}

function handleTests() {
Expand Down
5 changes: 4 additions & 1 deletion src/utils/configUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
* @param {Object.<string,string|null>} [replacements] - Map of file to replace -> replacement
* file name (or `null` to just remove the file), applied before packaging.
* @param {Object} [request] - Extra axios request options (e.g. custom headers) for the download.
* @param {boolean} [taxiProvider] - Whether this feed is exclusively a source of taxi
* provider data (OTP's `taxiProvider` build-config flag).
*/
const mapSrc = (id, url, fit, rules, replacements, request) => ({
const mapSrc = (id, url, fit, rules, replacements, request, taxiProvider) => ({
id,
url,
fit,
rules,
replacements,
request,
taxiProvider,
});

/**
Expand Down
Loading