From 0261facca3e5240c18c1693fd6478cdf583f864e Mon Sep 17 00:00:00 2001 From: tykayn Date: Mon, 7 Aug 2023 13:14:36 +0200 Subject: [PATCH] add async in build, start to make variance script Signed-off-by: tykayn --- mapping_geojson_to_osm_tags/build_departments.ts | 16 ++++++++++------ .../convert_to_osm_tags.ts | 4 ++-- .../make_variance_from_csv.ts | 7 +++++++ 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 mapping_geojson_to_osm_tags/make_variance_from_csv.ts diff --git a/mapping_geojson_to_osm_tags/build_departments.ts b/mapping_geojson_to_osm_tags/build_departments.ts index dd55608d..32e52428 100644 --- a/mapping_geojson_to_osm_tags/build_departments.ts +++ b/mapping_geojson_to_osm_tags/build_departments.ts @@ -18,17 +18,17 @@ function exec_command(command: string) { }); } -function build_department_geojson(department: string) { +async function build_department_geojson(department: string) { let command = `ts-node convert_to_osm_tags.ts --department=${department}`; console.log('command', command) - exec_command(command) + await exec_command(command) } -function convert_geojson_to_osm_for_department(department: string) { +async function convert_geojson_to_osm_for_department(department: string) { let command = `geojsontoosm output/my_converted_data_set_filtered_zipcode_${department}.json > osm_output/bornes-irve-filetered-from-etalab-opendata_dep_${department}.osm`; console.log('command', command) - exec_command(command) + await exec_command(command) } for (let ii = 1; ii <= max_departement; ii++) { @@ -48,8 +48,12 @@ let more_departements = ['2A', '2B' more_departements.forEach((department => { let departement_string = '' + department - build_department_geojson(departement_string) - convert_geojson_to_osm_for_department(departement_string) + build_department_geojson(departement_string).then(r => { + console.log('build_department_geojson', departement_string, r) + }) + convert_geojson_to_osm_for_department(departement_string).then(r => { + console.log('convert_geojson_to_osm_for_department', departement_string, r) + }) })) diff --git a/mapping_geojson_to_osm_tags/convert_to_osm_tags.ts b/mapping_geojson_to_osm_tags/convert_to_osm_tags.ts index 43c35a3b..d48afa35 100644 --- a/mapping_geojson_to_osm_tags/convert_to_osm_tags.ts +++ b/mapping_geojson_to_osm_tags/convert_to_osm_tags.ts @@ -23,9 +23,9 @@ let mini_arguments: any = minimist(process.argv.slice(2)) // let sourceFilePathGeoJson = './etalab_data/small.json' -// let sourceFilePathGeoJson = './etalab_data/all.json' +let sourceFilePathGeoJson = './etalab_data/all.json' // let sourceFilePathGeoJson = './output/my_converted_data_set_filtered_zipcode_91.json' -let sourceFilePathGeoJson = './output/my_converted_data_set_filtered_zipcode_91_small.json' +// let sourceFilePathGeoJson = './output/my_converted_data_set_filtered_zipcode_91_small.json' // wip filter let filterOnBoundingBox = true diff --git a/mapping_geojson_to_osm_tags/make_variance_from_csv.ts b/mapping_geojson_to_osm_tags/make_variance_from_csv.ts new file mode 100644 index 00000000..03b6978f --- /dev/null +++ b/mapping_geojson_to_osm_tags/make_variance_from_csv.ts @@ -0,0 +1,7 @@ +/** + prendre un CSV, + examiner toutes les colonnes et leurs valeurs, + garder en mémoire les valeurs uniques de chaque colonne + faire un nouveau csv qui ne montre que les valeurs uniques pour chacune des colonnes + et qui compte le nombre de valeurs + **/