forked from MapComplete/MapComplete
New graphs, script to create slices centerpoints
This commit is contained in:
parent
4a8823af4b
commit
cce6a9e832
23 changed files with 42133 additions and 41166 deletions
|
@ -662,15 +662,21 @@ function createMiscGraphs(allFeatures: ChangeSetData[], emptyCS: ChangeSetData[]
|
|||
}).render()
|
||||
const geojson = {
|
||||
type: "FeatureCollection",
|
||||
features: Utils.NoNull(allFeatures.map(f => {
|
||||
try {
|
||||
const point = GeoOperations.centerpoint(f.geometry);
|
||||
point.properties = f.properties
|
||||
return point
|
||||
} catch (e) {
|
||||
console.error("Could not create center point: ", e, f)
|
||||
return undefined
|
||||
}
|
||||
features: Utils.NoNull(allFeatures
|
||||
.map(f => {
|
||||
try {
|
||||
const point = GeoOperations.centerpoint(f.geometry);
|
||||
point.properties = {...f.properties, ...f.properties.metadata}
|
||||
delete point.properties.metadata
|
||||
for (const key in f.properties.metadata) {
|
||||
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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue