diff --git a/.github/scripts/minify-map-json.sh b/.github/scripts/minify-map-json.sh new file mode 100644 index 0000000..d512cc6 --- /dev/null +++ b/.github/scripts/minify-map-json.sh @@ -0,0 +1,4 @@ +npm install -g mapshaper +mapshaper ./boundaries.geo.json snap -clean -o force precision=0.0001 format=geojson ./boundaries.geo.json +npm install -g topojson-server +geo2topo ./boundaries.geo.json -q 50000 > ./website/data/boundaries.topo.json \ No newline at end of file diff --git a/.github/workflows/minify-map-json.yml b/.github/workflows/minify-map-json.yml new file mode 100644 index 0000000..b3886ee --- /dev/null +++ b/.github/workflows/minify-map-json.yml @@ -0,0 +1,23 @@ +name: Minify Map JSON +on: + push: + branches: + - master + paths: + - boundaries.geo.json +jobs: + mergeData: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Update TopoJSON boundaries + run: ./.github/scripts/minify-map-json.sh + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + commit-message: Update TopoJSON boundaries + title: Update TopoJSON boundaries + body: Clean and minify GeoJSON and process to TopoJSON + branch: geo-to-topo \ No newline at end of file