-
Notifications
You must be signed in to change notification settings - Fork 3
151 lines (144 loc) · 5.65 KB
/
belgium-flanders.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: 🇧🇪 Flanders, Belgium
on:
workflow_dispatch:
# Run at 12:00 UTC every 5 days (to make sure cache doesn't expire)
schedule:
- cron: "0 12 */5 * *"
push:
paths:
- ".github/workflows/belgium-flanders.yml"
- ".github/actions/*/action.yml"
- "script/**/*.ts"
- "data/belgium/flanders/convert.json"
- "data/belgium/flanders/filter.sql"
pull_request:
paths:
- ".github/workflows/belgium-flanders.yml"
- ".github/actions/*/action.yml"
- "script/**/*.ts"
- "data/belgium/flanders/convert.json"
- "data/belgium/flanders/filter.sql"
# Allow one concurrent deployment
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
MAPROULETTE_CHALLENGE_ID: 24090
WEGENREGISTER_URL: "https://download.vlaanderen.be/bff/v1/Orders/337327/download/79c09c5d-e2c5-45c0-a5fa-52734128aa01"
WEGENREGISTER_DATE: "20250130"
jobs:
diff:
name: Generate difference for Flanders, Belgium
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install GDAL
run: |
sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt install gdal-bin
- name: Install Tippecanoe
uses: ./.github/actions/install-tippecanoe
- name: Install dependencies
run: npm install
working-directory: script
- name: Build
run: npm run build
working-directory: script
- name: Generate OpenStreetMap buffers
uses: ./.github/actions/openstreetmap-buffers
with:
country: europe/belgium
- name: Cache WegenRegister data
id: cache-wegenregister
uses: actions/cache@v4
with:
path: Wegsegment.geojson
key: wegenregister-${{ env.WEGENREGISTER_DATE }}
- name: Download & Unzip Wegenregister data
if: ${{ steps.cache-wegenregister.outputs.cache-hit != 'true' }}
run: |
wget --content-disposition ${{ env.WEGENREGISTER_URL }}
unzip -j "Wegenregister_SHAPE_${{ env.WEGENREGISTER_DATE }}.zip" "Shapefile/Wegsegment.*"
- name: Convert (and filter) Wegenregister to GeoJSON
if: ${{ steps.cache-wegenregister.outputs.cache-hit != 'true' }}
run: |
ogr2ogr -f "GeoJSON" -progress \
--config SHAPE_ENCODING "ISO-8859-1" \
-s_srs "EPSG:31370" -t_srs "EPSG:4326" \
-sql "@data/belgium/flanders/filter.sql" \
-lco COORDINATE_PRECISION=6 \
-fieldTypeToString "All" \
"Wegsegment.geojson" \
"Wegsegment.shp"
- name: Convert Wegenregister fields to OpenStreetMap tags
run: node "script/convert-tags.js" -c "data/belgium/flanders/convert.json" "Wegsegment.geojson" "WegsegmentTagged.geojson"
- name: Generate Wegenregister vector tiles
run: |
tippecanoe --force --no-feature-limit --no-tile-size-limit \
--buffer=0 \
--maximum-zoom=14 --minimum-zoom=14 \
--layer="roads" \
--output="WegsegmentTagged.mbtiles" "WegsegmentTagged.geojson"
- name: Generate MapRoulette buffers
uses: ./.github/actions/maproulette-buffers
with:
challenge-id: ${{ env.MAPROULETTE_CHALLENGE_ID }}
- name: Upload MapRoulette false positive
uses: actions/upload-artifact@v4
with:
name: MapRoulette-FalsePositive
path: maproulette.geojson
- name: Merge MapRoulette buffers to OpenStreetMap buffers and generate vector tiles
run: |
tippecanoe --force --no-feature-limit --no-tile-size-limit \
--maximum-zoom=14 --minimum-zoom=14 \
--layer="buffers" \
--output="belgium-buffers.mbtiles" \
"openstreetmap-lines-buffers.geojson" "openstreetmap-polygons-buffers.geojson" "maproulette-buffers.geojson"
- name: Difference
run: node "script/difference.js" --output-dir="data/belgium/flanders/difference" "WegsegmentTagged.mbtiles" "belgium-buffers.mbtiles"
- name: Upload difference
uses: actions/upload-artifact@v4
with:
name: Flanders-Difference
path: data/belgium/flanders/difference/diff.geojson
- name: Upload statistics
uses: actions/upload-artifact@v4
with:
name: Flanders-Statistics
path: data/belgium/flanders/difference/stats.json
commit:
name: Commit & Push changes
needs: diff
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: Flanders-Difference
path: data/belgium/flanders/difference
- uses: actions/download-artifact@v4
with:
name: Flanders-Statistics
path: data/belgium/flanders/difference
- name: Commit & Push
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git pull
git add data/belgium/flanders/difference/diff.geojson
git add data/belgium/flanders/difference/stats.json
git commit -m "🗃 Update difference for Flanders, Belgium"
git push
mr-rebuild:
name: Rebuild MapRoulette challenge
needs: commit
runs-on: ubuntu-latest
steps:
- name: Call MapRoulette API
run: |
curl -X "PUT" "https://maproulette.org/api/v2/challenge/${{ env.MAPROULETTE_CHALLENGE_ID }}/rebuild?removeUnmatched=true&skipSnapshot=false" \
-H "Accept: application/json" \
-H "apiKey: ${{ secrets.MAPROULETTE_API_KEY }}"