🇱🇺 Luxembourg #213
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🇱🇺 Luxembourg | |
on: | |
workflow_dispatch: | |
# Run every Sunday at 12:00 UTC | |
schedule: | |
- cron: "0 12 * * 0" | |
push: | |
paths: | |
- ".github/workflows/luxembourg.yml" | |
- ".github/actions/*/action.yml" | |
- "script/**/*.ts" | |
- "data/luxembourg/convert.json" | |
- "data/luxembourg/filter.sql" | |
pull_request: | |
paths: | |
- ".github/workflows/luxembourg.yml" | |
- ".github/actions/*/action.yml" | |
- "script/**/*.ts" | |
- "data/luxembourg/convert.json" | |
- "data/luxembourg/filter.sql" | |
# Allow one concurrent deployment | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
MAPROULETTE_CHALLENGE_ID: 17749 | |
jobs: | |
diff: | |
name: Generate difference for Luxembourg | |
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/luxembourg | |
- name: Download & Unzip source data | |
run: | | |
wget --no-check-certificate -O "transport-et-voies-de-communication-shape.zip" "https://data.public.lu/fr/datasets/r/e74aadad-77c2-441e-98fe-e08a441484a2" | |
unzip "transport-et-voies-de-communication-shape.zip" "TRP_VC.*" | |
- name: Convert (and filter) source data to GeoJSON | |
run: | | |
ogr2ogr -f "GeoJSON" -progress \ | |
--config SHAPE_ENCODING "ISO-8859-1" \ | |
-s_srs "EPSG:2169" -t_srs "EPSG:4326" \ | |
-sql "@data/luxembourg/filter.sql" \ | |
-lco COORDINATE_PRECISION=6 \ | |
-fieldTypeToString "All" \ | |
"trpvc.geojson" \ | |
"TRP_VC.shp" | |
- name: Download extra data | |
run: | | |
wget -O "csventrifuge_enhance_name.csv" "https://raw.githubusercontent.com/osmlu/csventrifuge/master/rules/luxembourg_addresses/rue.csv" | |
wget -O "csventrifuge_enhance_id.csv" "https://raw.githubusercontent.com/osmlu/csventrifuge/master/enhance/luxembourg_addresses/id_caclr_rue/rue.csv" | |
- name: Process extra data | |
run: | | |
node "data/luxembourg/build-extended-conversion.js" "csventrifuge_enhance_name.csv" "csventrifuge_enhance_id.csv" "data/luxembourg/convert.json" "convert-merged.json" | |
- name: Convert fields to OpenStreetMap tags | |
run: node "script/convert-tags.js" -c "convert-merged.json" "trpvc.geojson" "trpvcTagged.geojson" | |
- name: Generate vector tiles | |
run: | | |
tippecanoe --force --no-feature-limit --no-tile-size-limit \ | |
--buffer=0 \ | |
--maximum-zoom=14 --minimum-zoom=14 \ | |
--layer="roads" \ | |
--output="trpvcTagged.mbtiles" "trpvcTagged.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="luxembourg-buffers.mbtiles" \ | |
"openstreetmap-lines-buffers.geojson" "openstreetmap-polygons-buffers.geojson" "maproulette-buffers.geojson" | |
- name: Difference | |
run: node "script/difference.js" --output-dir="data/luxembourg/difference" "trpvcTagged.mbtiles" "luxembourg-buffers.mbtiles" | |
- name: Upload difference | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Luxembourg-Difference | |
path: data/luxembourg/difference/diff.geojson | |
- name: Upload statistics | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Luxembourg-Statistics | |
path: data/luxembourg/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: Luxembourg-Difference | |
path: data/luxembourg/difference | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Luxembourg-Statistics | |
path: data/luxembourg/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/luxembourg/difference/diff.geojson | |
git add data/luxembourg/difference/stats.json | |
git commit -m "🗃 Update difference for Luxembourg" | |
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 }}" |