Compare commits
3 Commits
b1750eda4a
...
0db9565935
Author | SHA1 | Date |
---|---|---|
Tykayn | 0db9565935 | |
Tykayn | 01aef649fd | |
Tykayn | 7ce3058217 |
|
@ -71,9 +71,9 @@ let filterZipCodeAdresse = new RegExp(` ${filterDepartment}`)
|
||||||
let filteredName = ''
|
let filteredName = ''
|
||||||
|
|
||||||
if (enable_filter_on_department) {
|
if (enable_filter_on_department) {
|
||||||
filteredName = outname+'_filtered_zipcode_' + filterDepartment
|
filteredName = '_filtered_zipcode_' + filterDepartment
|
||||||
} else if (filterOnBoundingBox) {
|
} 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
|
let pointCounterMax: number = 1000000
|
||||||
|
|
||||||
|
@ -102,8 +102,9 @@ let output_folder = 'output';
|
||||||
*/
|
*/
|
||||||
function writeFile(fileName: string, fileContent: any) {
|
function writeFile(fileName: string, fileContent: any) {
|
||||||
let write_path = `./${output_folder}/${fileName}`
|
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(
|
return fs.writeFile(
|
||||||
write_path,
|
write_path,
|
||||||
|
@ -233,7 +234,7 @@ function convertDataForIRVE(sourceFilePath: string, mapping: any, pointCounterMa
|
||||||
// write file on disk
|
// write file on disk
|
||||||
if (converted_geo_json.features.length) {
|
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)
|
console.log('features: ', converted_geo_json.features.length)
|
||||||
debugLog('convert : write file ', fileNameToWrite)
|
debugLog('convert : write file ', fileNameToWrite)
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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
|
// TODO gestion des puissances de bornes
|
||||||
// avec une fonction de transformation des valeurs
|
// avec une fonction de transformation des valeurs
|
||||||
|
|
|
@ -310,7 +310,7 @@ export default class {
|
||||||
|
|
||||||
|
|
||||||
convertedValue = convertedValue.replace(' ', ' ').trim();
|
convertedValue = convertedValue.replace(' ', ' ').trim();
|
||||||
console.log('convertedValue', convertedValue)
|
debugLog('convertedValue', convertedValue)
|
||||||
if (
|
if (
|
||||||
/^\d/.test(convertedValue) &&
|
/^\d/.test(convertedValue) &&
|
||||||
!/^\+33 /.test(convertedValue)
|
!/^\+33 /.test(convertedValue)
|
||||||
|
@ -400,6 +400,7 @@ export default class {
|
||||||
// une transformation de la valeur
|
// une transformation de la valeur
|
||||||
// apply transformation to value
|
// apply transformation to value
|
||||||
convertedValue = conditionnalConfig.transform_function(originalValue)
|
convertedValue = conditionnalConfig.transform_function(originalValue)
|
||||||
|
console.log('transform_function: originalValue', originalValue, convertedValue)
|
||||||
}
|
}
|
||||||
// use the value converted
|
// use the value converted
|
||||||
else if (conditionnalConfig.value_converted) {
|
else if (conditionnalConfig.value_converted) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
|
||||||
let show_debug = 0
|
let show_debug = 0
|
||||||
show_debug = 1
|
// show_debug = 1
|
||||||
let output_folder = 'output';
|
let output_folder = 'output';
|
||||||
|
|
||||||
// console.log('----------------------show_debug', show_debug)
|
// 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
|
@ -18,9 +18,11 @@ wget https://www.data.gouv.fr/fr/datasets/r/7eee8f09-5d1b-4f48-a304-5e99e8da1e26
|
||||||
#
|
#
|
||||||
rm website-data.log
|
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"
|
cd ..
|
||||||
echo "fichier généré: $PWD/data_other/$output_file_name.geojson"
|
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"
|
#curl --header "Content-Type: plain/text" --data @content_irve_csv.txt --trace-ascii website-data.log "$overpass_website" > "../data_other/$output_file_name.csv"
|
||||||
|
|
|
@ -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"
|
|
Loading…
Reference in New Issue