New graphs, script to create slices centerpoints
|
@ -662,15 +662,21 @@ function createMiscGraphs(allFeatures: ChangeSetData[], emptyCS: ChangeSetData[]
|
||||||
}).render()
|
}).render()
|
||||||
const geojson = {
|
const geojson = {
|
||||||
type: "FeatureCollection",
|
type: "FeatureCollection",
|
||||||
features: Utils.NoNull(allFeatures.map(f => {
|
features: Utils.NoNull(allFeatures
|
||||||
try {
|
.map(f => {
|
||||||
const point = GeoOperations.centerpoint(f.geometry);
|
try {
|
||||||
point.properties = f.properties
|
const point = GeoOperations.centerpoint(f.geometry);
|
||||||
return point
|
point.properties = {...f.properties, ...f.properties.metadata}
|
||||||
} catch (e) {
|
delete point.properties.metadata
|
||||||
console.error("Could not create center point: ", e, f)
|
for (const key in f.properties.metadata) {
|
||||||
return undefined
|
point.properties[key] = f.properties.metadata[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return point
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Could not create center point: ", e, f)
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
writeFileSync("centerpoints.geojson", JSON.stringify(geojson, undefined, 2))
|
writeFileSync("centerpoints.geojson", JSON.stringify(geojson, undefined, 2))
|
||||||
|
|
13
Docs/Tools/cache_centerpoints.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
ts-node GenerateSeries.ts
|
||||||
|
# Move to the root of the repo
|
||||||
|
cd ../..
|
||||||
|
cd ../MapComplete-data
|
||||||
|
git pull
|
||||||
|
cd -
|
||||||
|
ts-node scripts/slice.ts Docs/Tools/centerpoints.geojson 8 ../MapComplete-data/mapcomplete-changes/
|
||||||
|
cd -
|
||||||
|
git add mapcomplete-changes/*
|
||||||
|
git commit -am "New changeset data"
|
||||||
|
git push
|
Before Width: | Height: | Size: 232 KiB After Width: | Height: | Size: 372 KiB |
Before Width: | Height: | Size: 364 KiB After Width: | Height: | Size: 365 KiB |
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 227 KiB |
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 140 KiB |
Before Width: | Height: | Size: 619 KiB After Width: | Height: | Size: 619 KiB |
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 848 KiB After Width: | Height: | Size: 846 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 549 KiB After Width: | Height: | Size: 549 KiB |
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 117 KiB |
Before Width: | Height: | Size: 586 KiB After Width: | Height: | Size: 605 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |