diff --git a/convert_to_osm_tags.ts b/convert_to_osm_tags.ts index bbd2743..3b2dcfe 100644 --- a/convert_to_osm_tags.ts +++ b/convert_to_osm_tags.ts @@ -10,7 +10,7 @@ import mappingConfigIRVEFromOsmose from './mappings/converters/configIRVE_osmose import mappingConfigIRVE_simple from './mappings/converters/mappingConfigIRVE_simple' import mappingTest from './mappings/converters/configTest' 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 mappingRouenParkingVelos from "./mappings/converters/configRouen_OpenData_velo_parkings"; @@ -146,7 +146,7 @@ function writeFile(fileName: string, fileContent: any) { * @param pointCounterMax * @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) 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 remove_original_key = false; - 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') { + feature_point.properties.tags?.forEach((tagKey:string, tagValue:string)=>{ + if (mapping.filters && mapping.filters.exclude_point_if_tag_not_empty?.indexOf(tagKey) !== -1 + && tagValue.length + && tagValue !== 'null') { remove_original_key = true; } })