oops update topojson
Also updates process.js and clarifies process in readme
This commit is contained in:
parent
c9ada6eb7b
commit
a8f06714bc
23
README.md
23
README.md
|
@ -24,13 +24,20 @@ This `process.js` file syncs any changes from the csv files into the topojson at
|
||||||
|
|
||||||
## Updating the topojson
|
## Updating the topojson
|
||||||
|
|
||||||
### Update boundaries
|
### 1. Update boundaries
|
||||||
|
|
||||||
* make a copy of `/public_library_map/boundaries.geo.json`
|
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.
|
||||||
* update in `qgis`
|
|
||||||
* save the copied file
|
|
||||||
|
|
||||||
### 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
|
#### Option 1
|
||||||
|
|
||||||
|
@ -41,13 +48,13 @@ This `process.js` file syncs any changes from the csv files into the topojson at
|
||||||
#### Option 2
|
#### Option 2
|
||||||
|
|
||||||
```bash
|
```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
|
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
|
```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
|
geo2topo boundaries.geo.json -q 50000 > website/data/boundaries.topo.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,9 @@ fs.createReadStream(`${data_directory}/library_services_information.csv`)
|
||||||
// write back to file
|
// write back to file
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(`${data_directory}/boundaries.topo.json`, JSON.stringify(data))
|
fs.writeFileSync(`${data_directory}/boundaries.topo.json`, JSON.stringify(data))
|
||||||
|
console.log('topo updated')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('ERROR writing topo file')
|
console.error('ERROR writing topo file')
|
||||||
|
console.error(err)
|
||||||
}
|
}
|
||||||
console.log('topo updated')
|
|
||||||
})
|
})
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue