Skip to content

Commit

Permalink
Add tiles.json (#8)
Browse files Browse the repository at this point in the history
* add tiles.json
  • Loading branch information
naogify authored Oct 13, 2022
1 parent ee33e05 commit a08fe00
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/docs
.envrc
/tiles
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apt-get update && apt-get -y install \
zlib1g-dev \
nodejs \
npm \
jq \
&& \
mkdir -p /tmp/build && cd /tmp/build && \
git clone https://github.com/mapbox/tippecanoe.git && \
Expand Down
25 changes: 25 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ FILE=$1
GEOLONIA_ACCESS_TOKEN=$2
OUT_DIR=$3

GH_REPOSITORY_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
TILES_OUT_DIR=$OUT_DIR/tiles
METADATA_JSON=$TILES_OUT_DIR/metadata.json
LAYER_NAME=data

mkdir -p $TILES_OUT_DIR
Expand All @@ -22,4 +24,27 @@ else
$FILE

find $TILES_OUT_DIR -name "*.pbf" -exec sh -c 'mv "$1" "${1%.pbf}".mvt' - '{}' \;

if [ -f $METADATA_JSON ]
then

cat $METADATA_JSON | jq '{
"tilejson": "3.0.0",
name: .name,
version: .version,
description: .description,
type: .type,
format: .format,
attribution: .attribution,
minzoom: .minzoom,
maxzoom: .maxzoom,
center: .center,
bounds: .bounds,
"tiles": [
"https://'${GITHUB_REPOSITORY_OWNER}'.github.io/'${GH_REPOSITORY_NAME}'/tiles/{z}/{x}/{y}.mvt"
]
}' > $TILES_OUT_DIR/tiles.json

fi

fi

0 comments on commit a08fe00

Please sign in to comment.