fix Action workflows
- fix incorrect key name in merge file (json_data['objects']['boundaries.geo'] rather than json_data['objects']['boundaries']) - don't merge csv and topo.json when topo.json changes, as this will create an infinite loop - run merge as part of geo-to-topo Action, after new topo file is created - remove redundant shell file
This commit is contained in:
parent
f22901f869
commit
92ad548b92
2
.github/scripts/merge_csv_to_topojson.py
vendored
2
.github/scripts/merge_csv_to_topojson.py
vendored
|
@ -10,7 +10,7 @@ geo = open(topojson_file, 'r') # open the topo.json file
|
|||
json_data = json.loads(geo.read()) # read the file and load into a dict
|
||||
|
||||
# for each feature, if the name in the json matches the name in the csv, add new properties to the json
|
||||
for feature in json_data['objects']['boundaries']['geometries']:
|
||||
for feature in json_data['objects']['boundaries.geo']['geometries']:
|
||||
with open(csv_file, newline='') as f:
|
||||
# use DictReader so we can use the header names
|
||||
reader = csv.DictReader(f)
|
||||
|
|
5
.github/scripts/minify-map-json.sh
vendored
5
.github/scripts/minify-map-json.sh
vendored
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
sudo npm install -g mapshaper
|
||||
mapshaper ./boundaries.geo.json snap -clean -o force precision=0.0001 format=geojson ./boundaries.geo.json
|
||||
sudo npm install -g topojson-server
|
||||
geo2topo ./boundaries.geo.json -q 50000 > ./website/data/boundaries.topo.json
|
1
.github/workflows/merge-csv-to-topojson.yml
vendored
1
.github/workflows/merge-csv-to-topojson.yml
vendored
|
@ -5,7 +5,6 @@ on:
|
|||
- master
|
||||
paths:
|
||||
- website/data/library_services_information.csv
|
||||
- website/data/boundaries.topo.json
|
||||
jobs:
|
||||
mergeData:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
1
.github/workflows/minify-map-json.yml
vendored
1
.github/workflows/minify-map-json.yml
vendored
|
@ -19,6 +19,7 @@ jobs:
|
|||
mapshaper boundaries.geo.json snap -clean -o force precision=0.0001 format=geojson boundaries.geo.json
|
||||
sudo npm install -g topojson-server
|
||||
geo2topo boundaries.geo.json -q 50000 > website/data/boundaries.topo.json
|
||||
python3 ./.github/scripts/merge_csv_to_topojson.py
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
|
|
Loading…
Reference in a new issue