|
3 | 3 | COMPOSE ?= docker compose |
4 | 4 | FRONTEND_DIR := frontend |
5 | 5 | PYTHON ?= python3 |
| 6 | +# ----- Container images ----- |
6 | 7 | FRONTEND_IMAGE_LOCAL := local/global-tsunami-risk-map-frontend:latest |
7 | 8 | FRONTEND_IMAGE_REMOTE := ghcr.io/yejiyang/global-tsunami-risk-map-frontend:latest |
| 9 | + |
| 10 | +# Utility containers for data processing (avoid local installs) |
| 11 | +GDAL_IMAGE := osgeo/gdal:alpine-small-latest |
| 12 | +TIPPE_IMAGE := emotionalcities/tippecanoe |
| 13 | + |
| 14 | +# Other flags |
8 | 15 | LOCAL ?= false # Set to 'true' to build and run with the local frontend image |
9 | 16 |
|
| 17 | +# Paths |
| 18 | +DATA_DIR := $(CURDIR)/data |
| 19 | + |
10 | 20 | .PHONY: help docker-build docker-up docker-down docker-logs docker-clean \ |
11 | 21 | docker-up-% docker-rebuild-% frontend-build frontend-serve \ |
12 | | - docker-build-frontend docker-run-local docker-run |
| 22 | + docker-build-frontend docker-run-local docker-run \ |
| 23 | + hazard-fgb hazard-tiles |
13 | 24 |
|
14 | 25 | .DEFAULT_GOAL := help |
15 | 26 |
|
@@ -78,3 +89,25 @@ frontend-build: ## Build frontend assets |
78 | 89 | frontend-serve: ## Build and serve frontend locally |
79 | 90 | @echo "Serving frontend locally on http://localhost:8080" |
80 | 91 | cd $(FRONTEND_DIR)/src && $(PYTHON) -m http.server 8080 |
| 92 | + |
| 93 | +# ----------------------------------------------------------------------------- |
| 94 | +# Data processing helpers (Hazard dataset) |
| 95 | +# ----------------------------------------------------------------------------- |
| 96 | + |
| 97 | +# Convert GeoJSON → FlatGeobuf using GDAL inside a lightweight container |
| 98 | +hazard-fgb: ## Generate FlatGeobuf for Global Hazard Points via Docker |
| 99 | + @echo "[hazard-fgb] Converting GeoJSON to FlatGeobuf (containerised GDAL)…" |
| 100 | + docker run --rm -v $(DATA_DIR):/data $(GDAL_IMAGE) \ |
| 101 | + ogr2ogr -f FlatGeobuf /data/hazard/global-hazard-points.fgb \ |
| 102 | + /data/hazard/global-hazard-points.geojson -nln GlobalHazardPoints |
| 103 | + |
| 104 | +# Create vector tiles (MVT) with tippecanoe inside a container |
| 105 | +hazard-tiles: ## Generate vector tiles for Global Hazard Points via Docker |
| 106 | + @echo "[hazard-tiles] Building vector tiles with tippecanoe (containerised)…" |
| 107 | + docker run --rm -v $(DATA_DIR):/data $(TIPPE_IMAGE) \ |
| 108 | + tippecanoe -r1 -pk -pf \ |
| 109 | + --output-to-directory=/data/tiles/global-hazard-2/ \ |
| 110 | + --force --maximum-zoom=15 \ |
| 111 | + --extend-zooms-if-still-dropping \ |
| 112 | + --no-tile-compression \ |
| 113 | + /data/hazard/global-hazard-points.geojson |
0 commit comments