Skip to content

Commit

Permalink
Use osmium instead of osmconvert for cropping
Browse files Browse the repository at this point in the history
  • Loading branch information
Booligoosh committed Jul 30, 2024
1 parent 350cd14 commit bb4bfa7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/update-tiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ 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
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: ./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 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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
16 changes: 16 additions & 0 deletions tiles/bbox.geojson
Original file line number Diff line number Diff line change
@@ -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"
}
}
6 changes: 0 additions & 6 deletions tiles/bbox.poly

This file was deleted.

0 comments on commit bb4bfa7

Please sign in to comment.