forked from MapComplete/MapComplete
Merge develop
This commit is contained in:
commit
c9697b7ffb
7 changed files with 130 additions and 115 deletions
24
scripts/downloadFromOverpass.ts
Normal file
24
scripts/downloadFromOverpass.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import Script from "./Script";
|
||||
import {TagUtils} from "../Logic/Tags/TagUtils";
|
||||
import {And} from "../Logic/Tags/And";
|
||||
import Constants from "../Models/Constants";
|
||||
import {ImmutableStore} from "../Logic/UIEventSource";
|
||||
import {BBox} from "../Logic/BBox";
|
||||
import {Overpass} from "../Logic/Osm/Overpass";
|
||||
const fs = require("fs")
|
||||
class DownloadFromOverpass extends Script {
|
||||
|
||||
constructor() {
|
||||
super("Downloads data from openstreetmap, will save this as 'export.geojson'. All arguments will be interpreted as key=value pairs");
|
||||
}
|
||||
async main(args: string[]): Promise<void> {
|
||||
const tags = new And(args.map(k => TagUtils.Tag(k)))
|
||||
const overpass = new Overpass(tags,[], Constants.defaultOverpassUrls[0], new ImmutableStore(500))
|
||||
const [data, _] = await overpass.queryGeoJson(BBox.global)
|
||||
fs.writeFileSync("export.geojson", JSON.stringify(data), "utf8")
|
||||
console.log("Written", data.features.length,"entries")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new DownloadFromOverpass().run()
|
|
@ -28,7 +28,7 @@ export default class GenerateImageAnalysis extends Script {
|
|||
tag,
|
||||
[],
|
||||
"https://overpass.kumi.systems/api/interpreter",
|
||||
new ImmutableStore(180),
|
||||
new ImmutableStore(500),
|
||||
undefined,
|
||||
false
|
||||
)
|
||||
|
@ -110,10 +110,10 @@ export default class GenerateImageAnalysis extends Script {
|
|||
|
||||
const msg = `${i}/${
|
||||
allImages.size
|
||||
} downloaded: ${d},skipped: ${s}, failed: ${f}, running: ${runningSecs}sec, ETA: ${estimatedActualMinutes}:${
|
||||
} downloaded: ${d},skipped: ${s}, failed: ${f}, running: ${Math.floor(runningSecs)}sec, ETA: ${estimatedActualMinutes}:${
|
||||
estimatedActualSeconds % 60
|
||||
}`
|
||||
ScriptUtils.erasableLog(msg)
|
||||
ScriptUtils.erasableLog( " ", msg)
|
||||
if (downloaded) {
|
||||
d++
|
||||
} else {
|
||||
|
@ -227,10 +227,10 @@ export default class GenerateImageAnalysis extends Script {
|
|||
}
|
||||
|
||||
async main(args: string[]): Promise<void> {
|
||||
const datapath = args[0] ?? "../MapComplete-data/ImageLicenseInfo"
|
||||
const datapath = args[0] ?? "../../git/MapComplete-data/ImageLicenseInfo"
|
||||
await this.downloadData(datapath)
|
||||
|
||||
//await this.downloadMetadata(datapath)
|
||||
await this.downloadMetadata(datapath)
|
||||
this.analyze(datapath)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue