forked from MapComplete/MapComplete
Small fixes
This commit is contained in:
parent
ac6f4e0289
commit
206f9047a0
3 changed files with 26 additions and 9 deletions
14
scripts/postal_code_tools/genWallonia.sh
Normal file
14
scripts/postal_code_tools/genWallonia.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Generates data for the wallonia address dataset: convex hulls for postal code outlines, tiled address files for import
|
||||
|
||||
wget https://opendata.bosa.be/download/best/openaddress-bewal.zip
|
||||
unzip openaddress-bewal.zip
|
||||
rm openaddress-bewal.zip
|
||||
mkdir data
|
||||
mkdir tiles
|
||||
mv openaddress-bewal.csv data/
|
||||
ts-node openaddressestogeojson.ts data/openaddress-bewal.csv data/openaddress --per-postal-code
|
||||
ts-node openaddressestogeojson.ts data/openaddress-bewal.csv data/openaddress.geojson.nljson
|
||||
ts-node ../slice.ts data/openaddress.geojson.nljson 14 tiles/
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
import * as fs from "fs";
|
||||
import * as readline from "readline";
|
||||
import ScriptUtils from "./ScriptUtils";
|
||||
import {existsSync, writeFileSync} from "fs";
|
||||
import {GeoOperations} from "../Logic/GeoOperations";
|
||||
import {Utils} from "../Utils";
|
||||
import {post} from "jquery";
|
||||
import {createECDH} from "crypto";
|
||||
import * as readline from "readline";
|
||||
import ScriptUtils from "../ScriptUtils";
|
||||
|
||||
/**
|
||||
* Converts an open-address CSV file into a big geojson file
|
||||
|
@ -35,7 +31,9 @@ async function main(args: string[]) {
|
|||
let failed = 0
|
||||
|
||||
let createdFiles : string [] = []
|
||||
if(!perPostalCode){
|
||||
fs.writeFileSync(outputFile, "")
|
||||
}
|
||||
// @ts-ignore
|
||||
for await (const line of rl) {
|
||||
i++;
|
||||
|
@ -65,6 +63,12 @@ async function main(args: string[]) {
|
|||
|
||||
let targetFile = outputFile
|
||||
if (perPostalCode) {
|
||||
if(parsed["postcode"] === ""){
|
||||
continue
|
||||
}
|
||||
if(isNaN(Number(parsed["postcode"]))){
|
||||
continue;
|
||||
}
|
||||
targetFile = outputFile + "-" + parsed["postcode"] + ".geojson"
|
||||
let isFirst = false
|
||||
if(!existsSync(targetFile)){
|
|
@ -1,6 +1,5 @@
|
|||
import * as fs from "fs";
|
||||
import ScriptUtils from "./ScriptUtils";
|
||||
import {post} from "jquery";
|
||||
import ScriptUtils from "../ScriptUtils";
|
||||
import {writeFileSync} from "fs";
|
||||
|
||||
function handleFile(file: string, postalCode: number) {
|
||||
|
|
Loading…
Reference in a new issue