Small fixes

This commit is contained in:
pietervdvn 2021-12-09 19:18:36 +01:00
parent ac6f4e0289
commit 206f9047a0
3 changed files with 26 additions and 9 deletions

View 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/

View file

@ -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 [] = []
fs.writeFileSync(outputFile, "")
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)){

View file

@ -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) {