Skip to content

Commit

Permalink
CSV対応 (#14)
Browse files Browse the repository at this point in the history
* CSV対応

* OUT_DIRとLAYER_NAMEを指定する。
  • Loading branch information
champierre authored Oct 18, 2022
1 parent d5b0761 commit ceacbec
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ RUN apt-get update && apt-get -y install \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

# Install csv2geojson
RUN npm install -g csv2geojson

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ You can get Geolonia Access Token at https://app.geolonia.com/#/team/general.
```shell
$ docker build -t geolonia/geolonia-locations-action .
# Use GitHub Pages, simply
$ docker run --rm -v $(pwd)/__test__:/__test__ -v $(pwd)/docs:/docs geolonia/geolonia-locations-action /__test__/data.geojson
$ docker run --rm -v $(pwd)/__test__:/__test__ -v $(pwd)/docs:/docs geolonia/geolonia-locations-action /__test__/data.geojson "" ./docs g-simplestyle-v1
# Use Geolonia SaaS
$ docker run --rm -v $(pwd)/__test__:/__test__ -v $(pwd)/docs:/docs geolonia/geolonia-locations-action /__test__/data.geojson $GEOLONIA_ACCESS_TOKEN
```
10 changes: 10 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
set -e

FILE=$1
EXT=${FILE##*.}
FILE_WITHOUT_EXT=${FILE%.*}
LOWER_EXT=`echo $EXT | tr '[:upper:]' '[:lower:]'`

GEOLONIA_ACCESS_TOKEN=$2
OUT_DIR=$3
LAYER_NAME=$4
Expand All @@ -12,6 +16,12 @@ METADATA_JSON=$TILES_OUT_DIR/metadata.json

mkdir -p $TILES_OUT_DIR

if [ "$LOWER_EXT" = "csv" ]; then
echo "Converting CSV to GeoJSON..."
csv2geojson --lat 緯度 --lon 経度 $FILE > $FILE_WITHOUT_EXT.geojson
FILE=$FILE_WITHOUT_EXT.geojson
fi

if [ $GEOLONIA_ACCESS_TOKEN ]; then
GEOLONIA_ACCESS_TOKEN=$GEOLONIA_ACCESS_TOKEN geolonia locations upload $1
else
Expand Down

0 comments on commit ceacbec

Please sign in to comment.