forked from MapComplete/MapComplete
improve typing
This commit is contained in:
parent
436e8286b7
commit
f43bd696f5
1 changed files with 3 additions and 6 deletions
|
@ -6,6 +6,7 @@ import { writeFileSync } from "fs"
|
||||||
import ScriptUtils from "./ScriptUtils"
|
import ScriptUtils from "./ScriptUtils"
|
||||||
import TagRenderingConfig from "../src/Models/ThemeConfig/TagRenderingConfig"
|
import TagRenderingConfig from "../src/Models/ThemeConfig/TagRenderingConfig"
|
||||||
import { And } from "../src/Logic/Tags/And"
|
import { And } from "../src/Logic/Tags/And"
|
||||||
|
import TagInfo from "../src/Logic/Web/TagInfo"
|
||||||
|
|
||||||
/* Downloads stats on osmSource-tags and keys from tagInfo */
|
/* Downloads stats on osmSource-tags and keys from tagInfo */
|
||||||
|
|
||||||
|
@ -49,9 +50,7 @@ async function main(includeTags = true) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Array.from(keysAndTags.keys()).map(async (key) => {
|
Array.from(keysAndTags.keys()).map(async (key) => {
|
||||||
const values = keysAndTags.get(key)
|
const values = keysAndTags.get(key)
|
||||||
const data = await Utils.downloadJson(
|
const data = await TagInfo.global.getStats(key)
|
||||||
`https://taginfo.openstreetmap.org/api/4/key/stats?key=${key}`
|
|
||||||
)
|
|
||||||
const count = data.data.find((item) => item.type === "all").count
|
const count = data.data.find((item) => item.type === "all").count
|
||||||
keyTotal.set(key, count)
|
keyTotal.set(key, count)
|
||||||
console.log(key, "-->", count)
|
console.log(key, "-->", count)
|
||||||
|
@ -60,9 +59,7 @@ async function main(includeTags = true) {
|
||||||
tagTotal.set(key, new Map<string, number>())
|
tagTotal.set(key, new Map<string, number>())
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Array.from(values).map(async (value) => {
|
Array.from(values).map(async (value) => {
|
||||||
const tagData = await Utils.downloadJson(
|
const tagData = await TagInfo.global.getStats(key, value)
|
||||||
`https://taginfo.openstreetmap.org/api/4/tag/stats?key=${key}&value=${value}`
|
|
||||||
)
|
|
||||||
const count = tagData.data.find((item) => item.type === "all").count
|
const count = tagData.data.find((item) => item.type === "all").count
|
||||||
tagTotal.get(key).set(value, count)
|
tagTotal.get(key).set(value, count)
|
||||||
console.log(key + "=" + value, "-->", count)
|
console.log(key + "=" + value, "-->", count)
|
||||||
|
|
Loading…
Reference in a new issue