Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JinIgarashi committed Jul 30, 2023
0 parents commit 953f2b6
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: "Build & deploy vector tiles"

on:
push:
branches: [ main ]
pull_request:
schedule:
- cron: '0 0 * * *'

env:
REGION: africa
AREA: kenya
BOUNDS: 34.58,-2.121,36.595,-0.419
BOUNDS_NAME: narok
TILEMAKER_IMAGE: ghcr.io/jinigarashi/tilemaker:master
PMTILES_IMAGE: ghcr.io/protomaps/go-pmtiles:main

jobs:

tilemaker-build:
name: Generate vector tiles by tilemaker
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Download PBF file
run: |
mkdir data
curl -L http://download.geofabrik.de/${{ env.REGION }}/${{ env.AREA }}-latest.osm.pbf -o ./data/${{ env.AREA }}.osm.pbf
- name: pull docker image
run: |
docker pull ${{ env.TILEMAKER_IMAGE }}
docker pull ${{ env.PMTILES_IMAGE }}
- name: Install osmium-tool
run: |
apt-get install osmium-tool
- name: Extract data by bounds
run: |
osmium extract --bbox=${{ env.BOUNDS }} --set-bounds --strategy=smart ./data/${{ env.AREA }}.osm.pbf --output ./data/${{ env.AREA }}-${{ env.BOUNDS_NAME }}.osm.pbf
- name: Build openmaptiles-compatible mbtiles files of given area
run: docker run -v $(pwd)/data:/srv ${{ env.TILEMAKER_IMAGE }} --input=/srv/${{ env.AREA }}-${{ env.BOUNDS_NAME }}.osm.pbf --output=/srv/${{ env.AREA }}-${{ env.BOUNDS_NAME }}.mbtiles

- name: Convert mbtiles to pmtiles
run: |
docker run -v $(pwd)/data:/srv ${{ env.PMTILES_IMAGE }} convert /srv/${{ env.AREA }}-${{ env.BOUNDS_NAME }}.mbtiles /srv/${{ env.AREA }}-${{ env.BOUNDS_NAME }}.pmtiles --tmpdir=/workspace
- name: clean deploy folder
run: |
rm ./data/${{ env.AREA }}.osm.pbf
rm ./data/${{ env.AREA }}-${{ env.BOUNDS_NAME }}.osm.pbf
rm ./data/${{ env.AREA }}-${{ env.BOUNDS_NAME }}.mbtiles
- name: deploy to gh-pages
uses: JamesIves/[email protected]
if: ${{ github.ref == 'refs/heads/main' }}
with:
branch: gh-pages # The branch the action should deploy to.
folder: data # The folder the action should deploy.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# osm-ke-narok

This repository is going to build OSM vector tiles by tilemaker and deploy it to gh-pages by Github Actions.

0 comments on commit 953f2b6

Please sign in to comment.