Skip to content

Update tiles

Update tiles #448

Workflow file for this run

name: Update tiles
on:
push:
paths:
- .github/workflows/update-tiles.yml
- "tiles/**/*"
branches:
- "main"
schedule:
- cron: "0 5 * * *"
workflow_dispatch:
jobs:
update-tiles:
environment: Tiles
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install osmium
run: sudo apt-get install osmium-tool
- name: Install pmtiles
run: |
wget https://github.com/protomaps/go-pmtiles/releases/download/v1.9.2/go-pmtiles_1.9.2_Linux_x86_64.tar.gz
tar -zxvf go-pmtiles_1.9.2_Linux_x86_64.tar.gz pmtiles
- name: Download OSM data
run: wget https://download.openstreetmap.fr/extracts/oceania/australia/new_south_wales.osm.pbf
- name: Crop OSM data
run: osmium extract new_south_wales.osm.pbf --output data.osm.pbf --polygon tiles/bbox.geojson --strategy=smart --set-bounds --overwrite
- name: Download coastline
run: wget https://osmdata.openstreetmap.de/download/water-polygons-split-4326.zip
- name: Extract coastline
run: unzip -j -d coastline water-polygons-split-4326.zip
# https://github.com/systemed/tilemaker/blob/master/docs/RUNNING.md#github-action
- name: Generate tiles
uses: systemed/tilemaker@master
with:
# Required, same to --input
input: data.osm.pbf
# Required, same to --output. Could be a directory or a .mbtiles files
output: map.mbtiles
# Optional, same to --config
# If not being set, default to resources/config-openmaptiles.config
config: tiles/config.json
# Optional, same to --process
# If not being set, default to resources/process-openmaptiles.lua
process: tiles/process.lua
# Optional, other arguments
# If not being set, default to '--verbose'
extra: --skip-integrity
- name: Convert mbtiles to pmtiles
run: ./pmtiles convert map.mbtiles map.pmtiles
# https://github.com/cloudflare/wrangler-action#readme
- name: Publish to Cloudflare R2
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: r2 object put sydneybikemap-tiles/map.pmtiles --file=map.pmtiles
packageManager: npm