add research on address to filter charging stations

This commit is contained in:
Tykayn 2023-07-29 21:59:51 +02:00 committed by tykayn
parent 70827f7ccc
commit 6ed29f8a93
10 changed files with 74217 additions and 1981373 deletions

View File

@ -7,11 +7,16 @@ import fs from 'node-fs';
let show_debug = 0; let show_debug = 0;
let filterCoordinates = true; let filterCoordinates = true;
let filterDepartment = 91; let filterDepartment = 974;
let filterZipCode = new RegExp(`^${filterDepartment}`); let filterZipCode = new RegExp(`^${filterDepartment}`);
let filterZipCodeAdresse = new RegExp(` ${filterDepartment}`);
let filteredName =''
if(filterCoordinates){
filteredName = '_filtered_zipcode_'+filterDepartment
}
let pointCounterMax = 10; let pointCounterMax = 1000000;
// let limitConversionToFirstPoint = false; // let limitConversionToFirstPoint = false;
// if (limitConversionToFirstPoint) { // if (limitConversionToFirstPoint) {
@ -100,17 +105,22 @@ function convertDataForIRVE(sourceFilePath, mapping, pointCounterMax) {
console.log('listOfPoints.length', listOfPoints.length) console.log('listOfPoints.length', listOfPoints.length)
listOfPoints.forEach(featurePoint => { listOfPoints.forEach(featurePoint => {
let regextestresult = filterZipCode.test(featurePoint.properties.consolidated_code_postal) let regextestresult = (
filterZipCode.test(featurePoint.properties.consolidated_code_postal)
|| 
filterZipCodeAdresse.test(featurePoint.properties.adresse_station)
)
// filter points depending on zipcode // filter points depending on zipcode
if (filterCoordinates && regextestresult) { if (filterCoordinates && regextestresult) {
console.log('featurePoint.properties.consolidated_code_postal', featurePoint.properties.consolidated_code_postal) debugLog('featurePoint.properties.consolidated_code_postal', featurePoint.properties.consolidated_code_postal)
// limit results number of points // limit results number of points
// if (pointcounter < pointCounterMax) { // if (pointcounter < pointCounterMax) {
console.log('add point') debugLog('add point')
debugLog('featurePoint', featurePoint) debugLog('featurePoint', featurePoint)
@ -127,7 +137,9 @@ function convertDataForIRVE(sourceFilePath, mapping, pointCounterMax) {
// output new geojson // output new geojson
console.log('convertedGeoJson.features.length', convertedGeoJson.features.length) console.log('convertedGeoJson.features.length', convertedGeoJson.features.length)
// write file on disk // write file on disk
writeJsonFile('my_converted_data_set.json', JSON.stringify(convertedGeoJson, null, 2)) let fileNameToWrite = 'my_converted_data_set'+filteredName+'.json';
console.log('write file ',fileNameToWrite )
writeJsonFile( fileNameToWrite, JSON.stringify(convertedGeoJson, null, 2))
debugLog('mapped output:', convertedGeoJson.features) debugLog('mapped output:', convertedGeoJson.features)

View File

@ -0,0 +1 @@
,tykayn,spaceship,29.07.2023 21:47,file:///home/tykayn/.config/libreoffice/4;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
{ {
"name": "bornes elec irve osm", "name": "mapping_geojson_to_osm_tags",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {