update filter from searched tag being not null

This commit is contained in:
Tykayn 2024-10-07 23:30:10 +02:00 committed by tykayn
parent 2ff5a68998
commit 0ea1f6bdc9

View File

@ -10,7 +10,7 @@ import mappingConfigIRVEFromOsmose from './mappings/converters/configIRVE_osmose
import mappingConfigIRVE_simple from './mappings/converters/mappingConfigIRVE_simple' import mappingConfigIRVE_simple from './mappings/converters/mappingConfigIRVE_simple'
import mappingTest from './mappings/converters/configTest' import mappingTest from './mappings/converters/configTest'
import mapping_engine from './mappings/engine' import mapping_engine from './mappings/engine'
import {BoundingBoxCoordinatesType, FeatureCollection} from "./mappings/mapping-config.type"; import MappingConfigType, {BoundingBoxCoordinatesType, FeatureCollection} from "./mappings/mapping-config.type";
import utils from './mappings/utils' import utils from './mappings/utils'
import mappingRouenParkingVelos from "./mappings/converters/configRouen_OpenData_velo_parkings"; import mappingRouenParkingVelos from "./mappings/converters/configRouen_OpenData_velo_parkings";
@ -146,7 +146,7 @@ function writeFile(fileName: string, fileContent: any) {
* @param pointCounterMax * @param pointCounterMax
* @param boundingBoxCoordinates * @param boundingBoxCoordinates
*/ */
function convertDataFromSource(sourceFilePath: string, mapping: any, pointCounterMax: number, boundingBoxCoordinates: any) { function convertDataFromSource(sourceFilePath: string, mapping: MappingConfigType, pointCounterMax: number, boundingBoxCoordinates: any) {
debugLog('convert data: source file from :', sourceFilePath) debugLog('convert data: source file from :', sourceFilePath)
fs.readFile(sourceFilePath, 'utf8', function (err, data) { fs.readFile(sourceFilePath, 'utf8', function (err, data) {
@ -177,8 +177,10 @@ function convertDataFromSource(sourceFilePath: string, mapping: any, pointCounte
let regex_filter_test_result = true let regex_filter_test_result = true
let remove_original_key = false; let remove_original_key = false;
feature_point.properties.tags.forEach((tagKey:string, tagValue:string)=>{ feature_point.properties.tags?.forEach((tagKey:string, tagValue:string)=>{
if (this.mapping_config.filters.exclude_point_if_tag_not_empty.indexOf(tagKey) !== -1 && tagValue.length && tagValue !== 'null') { if (mapping.filters && mapping.filters.exclude_point_if_tag_not_empty?.indexOf(tagKey) !== -1
&& tagValue.length
&& tagValue !== 'null') {
remove_original_key = true; remove_original_key = true;
} }
}) })