From 38da40ba719c3eb8b62ea7c8c8672e950d5d5b8d Mon Sep 17 00:00:00 2001 From: Ethan Date: Tue, 30 Jul 2024 21:29:32 +1000 Subject: [PATCH] Use osmium instead of osmconvert for cropping --- .github/workflows/update-tiles.yml | 10 ++++------ tiles/README.md | 4 ++-- tiles/bbox.geojson | 16 ++++++++++++++++ tiles/bbox.poly | 6 ------ 4 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 tiles/bbox.geojson delete mode 100644 tiles/bbox.poly diff --git a/.github/workflows/update-tiles.yml b/.github/workflows/update-tiles.yml index cea55d4..5e43191 100644 --- a/.github/workflows/update-tiles.yml +++ b/.github/workflows/update-tiles.yml @@ -18,10 +18,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Install osmconvert - run: | - wget http://m.m.i24.cc/osmconvert64 - chmod +x osmconvert64 + - 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 @@ -29,7 +27,7 @@ jobs: - name: Download OSM data run: wget https://download.openstreetmap.fr/extracts/oceania/australia/new_south_wales.osm.pbf - name: Crop OSM data - run: ./osmconvert64 new_south_wales.osm.pbf -o=data.osm.pbf --complete-ways -B=tiles/bbox.poly + 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 @@ -50,7 +48,7 @@ jobs: process: tiles/process.lua # Optional, other arguments # If not being set, default to '--verbose' - # extra: --threads 0 + extra: --verbose --skip-integrity - name: Convert mbtiles to pmtiles run: ./pmtiles convert map.mbtiles map.pmtiles # https://github.com/cloudflare/wrangler-action#readme diff --git a/tiles/README.md b/tiles/README.md index cfb3fe7..e65fc87 100755 --- a/tiles/README.md +++ b/tiles/README.md @@ -70,9 +70,9 @@ Download the OSM dump for NSW, clip the bounding box, create the tiles (specifie ```bash wget https://download.openstreetmap.fr/extracts/oceania/australia/new_south_wales.osm.pbf -osmconvert new_south_wales.osm.pbf -o=data.osm.pbf --complete-ways -B=bbox.poly +osmium extract new_south_wales.osm.pbf --output data.osm.pbf --polygon bbox.geojson --strategy=smart --set-bounds --overwrite -tilemaker --input data.osm.pbf --output map.mbtiles --process process.lua --config config.json +tilemaker --input data.osm.pbf --output map.mbtiles --process process.lua --config config.json --verbose --skip-integrity pmtiles convert map.mbtiles map.pmtiles ``` diff --git a/tiles/bbox.geojson b/tiles/bbox.geojson new file mode 100644 index 0000000..1e13f4f --- /dev/null +++ b/tiles/bbox.geojson @@ -0,0 +1,16 @@ +{ + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [149.536285, -34.927346], + [149.536285, -32.231172], + [152.571173, -32.231172], + [152.571173, -34.927346], + [149.536285, -34.927346] + ] + ], + "type": "Polygon" + } +} diff --git a/tiles/bbox.poly b/tiles/bbox.poly deleted file mode 100644 index 6e07066..0000000 --- a/tiles/bbox.poly +++ /dev/null @@ -1,6 +0,0 @@ -bbox - 149.536285 -34.927346 - 149.536285 -32.231172 - 152.571173 -32.231172 - 152.571173 -34.927346 -END \ No newline at end of file