Skip to content

Commit 7ceb60d

Browse files
committed
fix: airports example not working anymore
1 parent ff173b6 commit 7ceb60d

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

examples/airports/jobfile.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ let generateTask = (id, feature, params) => {
2222
const convergenceFactor = Math.cos(latitude * Math.PI / 180)
2323
const dLatitude = 360 * params.resolution / (2 * Math.PI * earthRadius)
2424
const dLongitude = dLatitude * convergenceFactor
25-
const halfWidthLatitude = 360 * params.halfWidth / (2 * Math.PI * earthRadius)
26-
const halfWidthLongitude = halfWidthLatitude * convergenceFactor
25+
let halfWidthLatitude = 0
26+
let halfWidthLongitude = 0
27+
if (params.outputSize) {
28+
halfWidthLatitude = dLatitude * params.outputSize.height / 2
29+
halfWidthLongitude = dLongitude * params.outputSize.width / 2
30+
} else {
31+
halfWidthLatitude = 360 * params.halfWidth / (2 * Math.PI * earthRadius)
32+
halfWidthLongitude = halfWidthLatitude * convergenceFactor
33+
}
2734
return {
2835
id,
36+
store: 'output-store',
2937
feature,
3038
resolution: spec.resolution,
3139
layer: params.layer,
@@ -80,6 +88,7 @@ hooks.registerHook('generateTasks', generateTasks)
8088

8189
export default {
8290
id: 'airports-download',
91+
store: 'output-store',
8392
options: {
8493
workersLimit: 4
8594
},
@@ -98,12 +107,19 @@ export default {
98107
},
99108
jobs: {
100109
before: {
110+
createStores: [{
111+
id: 'output-store',
112+
type: 'fs',
113+
storePath: 'taskTemplate.outputStore',
114+
options: { path: path.join(__dirname, '..', 'output') }
115+
}],
101116
generateTasks: {
102117
runways: spec.runways || [],
103118
airports: spec.airports || []
104119
}
105120
},
106121
after: {
122+
removeStores: ['output-store']
107123
}
108124
}
109125
}

0 commit comments

Comments
 (0)