Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion process.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ for arg in "$@"; do
--parks) PARKS=1; ALL=0 ;;
--pois) POIS=1; ALL=0 ;;
--addresses) ADDRESSES=1; ALL=0 ;;
--waterways) WATERWAYS=1; ALL=0 ;;
--osmium-index-type=*) OSMIUM_INDEX_TYPE="${arg#*=}" ;;
--duckdb-memory-limit=*) DUCKDB_MEMORY_LIMIT="${arg#*=}" ;;
*) echo "Unknown argument: $arg" >&2; exit 1 ;;
esac
done

if [ "$ALL" = "1" ]; then
BUILDINGS=1; HIGHWAYS=1; BOUNDARIES=1; SETTLEMENTS=1; PARKS=1; POIS=1; ADDRESSES=1
BUILDINGS=1; HIGHWAYS=1; BOUNDARIES=1; SETTLEMENTS=1; PARKS=1; POIS=1; ADDRESSES=1; WATERWAYS=1
fi

mkdir -p "$OUTPUT_DIR"
Expand Down Expand Up @@ -76,5 +77,6 @@ run_layer() {
[ "$PARKS" = "1" ] && run_layer parks
[ "$POIS" = "1" ] && run_layer pois
[ "$ADDRESSES" = "1" ] && run_layer addresses
[ "$WATERWAYS" = "1" ] && run_layer waterways

echo "Done"
52 changes: 52 additions & 0 deletions sql/waterways.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
COPY (
WITH raw AS (
SELECT type, id, tags, geometry
FROM '{{INPUT}}'
WHERE kind = 'line'
AND tags['waterway'] IN ('river', 'stream', 'canal', 'ditch', 'drain', 'flowline', 'fairway', 'link')
)
SELECT
type,
id,
tags['waterway'] AS waterway,
split_multi(tags['name']) AS name,
prefix_map_split('name:', tags) AS names,
tags['ref'] AS ref,
tags['intermittent'] AS intermittent,
tags['layer'] AS layer,
tags['bridge'] AS bridge,
tags['tunnel'] AS tunnel,
tags['access'] AS access,
-- General
tags['usage'] AS usage,
split_multi(tags['seasonal']) AS seasonal,
tags['tidal'] AS tidal,
-- Dimensions
tags['width'] AS width,
tags['depth'] AS depth,
-- Navigation and obstructions
tags['oneway'] AS oneway,
tags['lock'] AS lock,
tags['lock_name'] AS lock,
tags['lock_ref'] AS lock,
-- Access
tags['motorboat'] AS motorboat,
tags['ship'] AS ship,
tags['sailboat'] AS sailboat,
tags['boat'] AS boat,
tags['canoe'] AS canoe,
-- Hazards
tags['open_water'] AS open_water,
tags['narrow'] AS narrow,
tags['rapids'] AS rapids,
tags['rapids:name'] AS 'rapids:name',
tags['hazard'] AS hazard,
{
xmin: ST_XMin(geometry)::FLOAT,
ymin: ST_YMin(geometry)::FLOAT,
xmax: ST_XMax(geometry)::FLOAT,
ymax: ST_YMax(geometry)::FLOAT
} AS bbox,
geometry
FROM raw
) TO '{{OUTPUT}}' WITH (FORMAT PARQUET, COMPRESSION ZSTD);