Skip to content

Commit

Permalink
Add addresses scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bdon committed Jul 13, 2024
1 parent ba25592 commit 3811ccf
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/2024-06-13-beta/addresses.filter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"place": [
"all",
["attribute-filter", "id", [">=", "$zoom", 14]],
["attribute-filter", "street", [">=", "$zoom", 14]],
["attribute-filter", "number", [">=", "$zoom", 14]],
["attribute-filter", "unit", [">=", "$zoom", 14]],
["attribute-filter", "postcode", [">=", "$zoom", 14]],
["attribute-filter", "address_levels", [">=", "$zoom", 14]],
["attribute-filter", "country", [">=", "$zoom", 14]],
["attribute-filter", "version", [">=", "$zoom", 14]],
["attribute-filter", "sources", [">=", "$zoom", 14]]
]
}
27 changes: 27 additions & 0 deletions scripts/2024-06-13-beta/addresses.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

set -e
set -u
set -o pipefail
duckdb -c "
load spatial;
COPY (
SELECT
'Feature' AS type,
json(st_asgeojson(st_geomfromwkb(geometry))) AS geometry,
json_object(
'id', id,
'street', street,
'number', number,
'unit', unit,
'postcode', postcode,
'address_levels', address_levels,
'country', country,
'version', version,
'sources', sources
) AS properties,
row_number() over () as id,
FROM read_parquet('$1/theme=addresses/type=address/*')
) TO STDOUT (FORMAT json);
" | tippecanoe -o $2 --force -J $SCRIPT_DIR/addresses.filter.json -l address -rg --drop-densest-as-needed --extend-zooms-if-still-dropping --progress-interval=10

0 comments on commit 3811ccf

Please sign in to comment.