Merge pull request 'oops update topojson' (#204) from wagga into main

Reviewed-on: #204
This commit is contained in:
Hugh Rundle 2025-02-22 15:04:13 +11:00
commit 0f91f45960
3 changed files with 18 additions and 10 deletions

View file

@ -24,13 +24,20 @@ This `process.js` file syncs any changes from the csv files into the topojson at
## Updating the topojson
### Update boundaries
### 1. Update boundaries
* make a copy of `/public_library_map/boundaries.geo.json`
* update in `qgis`
* save the copied file
This could be a bit of faffing around, depending what you are trying to do. Merging existing entities together is reasonably easy, but if you need to pull a council area out of a regional library, for example, you might need to mess around with LGA maps.
### Simplify to reduce the file size
**Always work with copies of the original files**.
1. `boundaries.geo.json` should be aligned with `boundaries.topo.json`. If in doubt, use `topojson-client`'s `topo2geo` to get a geojson file with the most up to date data from the topojson:
`topo2geo boundaries_new.geo.json < boundaries.topo.json`
2. update in `qgis`
3. export out to geojson
### 2. Simplify to reduce the file size
#### Option 1
@ -41,13 +48,13 @@ This `process.js` file syncs any changes from the csv files into the topojson at
#### Option 2
```bash
sudo npm install -g mapshaper
sudo npm install -g mapshaper # if not already installed
mapshaper boundaries.geo.json snap -clean -o force precision=0.0001 format=geojson boundaries.geo.json
```
### Turn it into `topojson`:
### 3. Turn it back into `topojson`:
```bash
sudo npm install -g topojson-server
sudo npm install -g topojson-server # if not already installed
geo2topo boundaries.geo.json -q 50000 > website/data/boundaries.topo.json
```

View file

@ -28,8 +28,9 @@ fs.createReadStream(`${data_directory}/library_services_information.csv`)
// write back to file
try {
fs.writeFileSync(`${data_directory}/boundaries.topo.json`, JSON.stringify(data))
console.log('topo updated')
} catch (err) {
console.error('ERROR writing topo file')
console.error(err)
}
console.log('topo updated')
})

File diff suppressed because one or more lines are too long