Skip to content

🇧🇪 Brussels, Belgium #256

🇧🇪 Brussels, Belgium

🇧🇪 Brussels, Belgium #256

name: 🇧🇪 Brussels, Belgium
on:
workflow_dispatch:
# Run every Sunday at 12:00 UTC
schedule:
- cron: "0 12 * * 0"
push:
paths:
- ".github/workflows/belgium-brussels.yml"
- ".github/actions/*/action.yml"
- "script/**/*.ts"
- "data/belgium/brussels/convert.json"
- "data/belgium/brussels/filter.sql"
pull_request:
paths:
- ".github/workflows/belgium-brussels.yml"
- ".github/actions/*/action.yml"
- "script/**/*.ts"
- "data/belgium/brussels/convert.json"
- "data/belgium/brussels/filter.sql"
# Allow one concurrent deployment
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
MAPROULETTE_CHALLENGE_ID: 14675
jobs:
diff:
name: Generate difference for Brussels, 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: Download & Unzip UrbIS data
run: |
wget --no-check-certificate "https://urbisdownload.datastore.brussels/UrbIS/Vector/M7/2D/UrbAdm/Daily/SHP_LITE/UrbAdm_SHP.zip"
unzip "UrbAdm_SHP.zip" "shp/UrbAdm_STREET_AXIS.*"
- name: Convert (and filter) UrbIS to GeoJSON
run: |
ogr2ogr -f "GeoJSON" -progress \
-s_srs "EPSG:31370" -t_srs "EPSG:4326" \
-sql "@data/belgium/brussels/filter.sql" \
-lco COORDINATE_PRECISION=6 \
-fieldTypeToString "All" \
"UrbAdm_STREET_AXIS.geojson" \
"shp/UrbAdm_STREET_AXIS.shp"
- name: Convert UrbIS fields to OpenStreetMap tags
run: node "script/convert-tags.js" -c "data/belgium/brussels/convert.json" "UrbAdm_STREET_AXIS.geojson" "UrbAdm_STREET_AXISTagged.geojson"
- name: Generate UrbIS vector tiles
run: |
tippecanoe --force --no-feature-limit --no-tile-size-limit \
--buffer=0 \
--maximum-zoom=14 --minimum-zoom=14 \
--layer="roads" \
--output="UrbAdm_STREET_AXISTagged.mbtiles" "UrbAdm_STREET_AXISTagged.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@v3
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/brussels/difference" "UrbAdm_STREET_AXISTagged.mbtiles" "belgium-buffers.mbtiles"
- name: Upload difference
uses: actions/upload-artifact@v3
with:
name: Brussels-Difference
path: data/belgium/brussels/difference/diff.geojson
- name: Upload statistics
uses: actions/upload-artifact@v3
with:
name: Brussels-Statistics
path: data/belgium/brussels/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@v3
with:
name: Brussels-Difference
path: data/belgium/brussels/difference
- uses: actions/download-artifact@v3
with:
name: Brussels-Statistics
path: data/belgium/brussels/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/brussels/difference/diff.geojson
git add data/belgium/brussels/difference/stats.json
git commit -m "🗃 Update difference for Brussels, 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 }}"