Compare commits

...

3 Commits

Author SHA1 Message Date
Tykayn 0db9565935 add transform to max output 2023-10-01 11:56:42 +02:00
Tykayn 01aef649fd up irve script 2023-10-01 11:23:19 +02:00
Tykayn 7ce3058217 up irve script update 2023-10-01 11:23:07 +02:00
9 changed files with 5816155 additions and 39 deletions

View File

@ -71,9 +71,9 @@ let filterZipCodeAdresse = new RegExp(` ${filterDepartment}`)
let filteredName = ''
if (enable_filter_on_department) {
filteredName = outname+'_filtered_zipcode_' + filterDepartment
filteredName = '_filtered_zipcode_' + filterDepartment
} else if (filterOnBoundingBox) {
filteredName = outname+'_filtered_bbox_' + boundingBoxCoordinates.xMin + '-' + boundingBoxCoordinates.xMax + '_' + boundingBoxCoordinates.yMin + '-' + boundingBoxCoordinates.yMax
filteredName = '_filtered_bbox_' + boundingBoxCoordinates.xMin + '-' + boundingBoxCoordinates.xMax + '_' + boundingBoxCoordinates.yMin + '-' + boundingBoxCoordinates.yMax
}
let pointCounterMax: number = 1000000
@ -102,8 +102,9 @@ let output_folder = 'output';
*/
function writeFile(fileName: string, fileContent: any) {
let write_path = `./${output_folder}/${fileName}`
debugLog('write file ', fileName, write_path)
debugLog('write file ', outname+fileName, write_path)
console.log('write file, write_path', fileName, write_path)
return fs.writeFile(
write_path,
@ -233,7 +234,7 @@ function convertDataForIRVE(sourceFilePath: string, mapping: any, pointCounterMa
// write file on disk
if (converted_geo_json.features.length) {
let fileNameToWrite = 'converted_' + filteredName + '.json'
let fileNameToWrite = 'converted_' + outname + filteredName + '.json'
console.log('features: ', converted_geo_json.features.length)
debugLog('convert : write file ', fileNameToWrite)

File diff suppressed because it is too large Load Diff

View File

@ -147,6 +147,20 @@ const MappingIRVE: MappingConfigType = {
]
}
}
},
puissance_nominale: {
key_converted: 'socket:max:output',
conditionnal_values: {
transform_function: (original_value:string) => {
let converted_value = parseInt(original_value)
let accepted_values = [3, 7, 22, 50, 150, 300]
if (accepted_values.includes(converted_value)) {
return converted_value+ ' kW'
} else {
return null
}
},
}
}
// TODO gestion des puissances de bornes
// avec une fonction de transformation des valeurs

View File

@ -310,7 +310,7 @@ export default class {
convertedValue = convertedValue.replace(' ', ' ').trim();
console.log('convertedValue', convertedValue)
debugLog('convertedValue', convertedValue)
if (
/^\d/.test(convertedValue) &&
!/^\+33 /.test(convertedValue)
@ -400,6 +400,7 @@ export default class {
// une transformation de la valeur
// apply transformation to value
convertedValue = conditionnalConfig.transform_function(originalValue)
console.log('transform_function: originalValue', originalValue, convertedValue)
}
// use the value converted
else if (conditionnalConfig.value_converted) {

View File

@ -1,7 +1,7 @@
import fs from 'fs'
let show_debug = 0
show_debug = 1
// show_debug = 1
let output_folder = 'output';
// console.log('----------------------show_debug', show_debug)

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -18,9 +18,11 @@ wget https://www.data.gouv.fr/fr/datasets/r/7eee8f09-5d1b-4f48-a304-5e99e8da1e26
#
rm website-data.log
ts-node "$PWD/../convert_to_osm_tags.ts" --engine=true --source="$PWD/../etalab_data/irve_bornes_recharge/latest.json" --outname="irve-latest.json"
echo "fichier généré: $PWD/data_other/$output_file_name.geojson"
cd ..
ts-node convert_to_osm_tags.ts --engine=true --source="etalab_data/irve_bornes_recharge/latest.json" --outname="_irve-latest-etalab_"
geojson2osm "$PWD/../etalab_data/irve_bornes_recharge/latest.json" > "$PWD/../osm_output/bornes-irve-filetered_latest.osm"
echo "fichier généré: $PWD/output/converted__irve-latest-etalab_.json"
geojson2osm "$PWD/output/converted__irve-latest-etalab_.json" > "$PWD/osm_output/bornes-irve-filetered_latest.osm"
#curl --header "Content-Type: plain/text" --data @content_irve_csv.txt --trace-ascii website-data.log "$overpass_website" > "../data_other/$output_file_name.csv"

View File

@ -1,26 +0,0 @@
#!/bin/bash
echo "récupérer les bornes de recharge en Essonne"
overpass_website="https://overpass-api.de/api/interpreter"
# personnaliser les scripts:
# aire Essonne: id 3600007401
# aire IDF: id 3600008649
# aire FR: id 3602202162
output_file_name='irve_osm_latest'
# récupérer le jeu de données étalab le plus récent
wget https://www.data.gouv.fr/fr/datasets/r/7eee8f09-5d1b-4f48-a304-5e99e8da1e26 -O ../etalab_data/irve_bornes_recharge/latest.json
# récupérer les données présentes dans osm
#curl --header "Content-Type: plain/text" --data @content_irve_geojson.txt --trace-ascii website-data.log "$overpass_website" > "../data_other/$output_file_name.geojson"
#
#du -sch ../data_other/irve_osm_2023-08-30.csv
#
rm website-data.log
ts-node "$PWD/../convert_to_osm_tags.ts" --engine=true --source="$PWD/../etalab_data/latest.json" --outname="irve-latest.json"
echo "fichier généré: $PWD/data_other/$output_file_name.geojson"
geojson2osm "$PWD/../etalab_data/irve_bornes_recharge/latest.json" > "$PWD/../osm_output/bornes-irve-filetered_latest.osm"
#curl --header "Content-Type: plain/text" --data @content_irve_csv.txt --trace-ascii website-data.log "$overpass_website" > "../data_other/$output_file_name.csv"