diff --git a/convert_to_osm_tags.ts b/convert_to_osm_tags.ts index f09ca69..50f4e98 100644 --- a/convert_to_osm_tags.ts +++ b/convert_to_osm_tags.ts @@ -125,7 +125,7 @@ function writeFile(fileName: string, fileContent: any) { * @param boundingBoxCoordinates */ function convertDataForIRVE(sourceFilePath: string, mapping: any, pointCounterMax: number, boundingBoxCoordinates: any) { - debugLog('convertDataForIRVE from ', sourceFilePath) + debugLog('convert data: source file from :', sourceFilePath) fs.readFile(sourceFilePath, 'utf8', function (err, data) { let point_counter = 0 diff --git a/mappings/converters/configTest.ts b/mappings/converters/configTest.ts index 7c0da43..5a3bf04 100644 --- a/mappings/converters/configTest.ts +++ b/mappings/converters/configTest.ts @@ -6,7 +6,7 @@ import MappingConfigType from "../mapping-config.type"; const MappingTest: MappingConfigType = { - config_name: 'testing config mappingSame', + config_name: 'testing config MappingTest', config_author: 'tykayn ', default_properties_of_point: {}, tags: { diff --git a/mappings/engine.ts b/mappings/engine.ts index 053bb78..3a875b5 100644 --- a/mappings/engine.ts +++ b/mappings/engine.ts @@ -114,6 +114,7 @@ export default class { featurePointPropertiesKeys.forEach(pointKeyName => { debugLog('mapElementFromConf: convert', pointKeyName) + debugLog('mapElementFromConf: mapping keys:', mappingKeys) this.convertProperty(pointKeyName, mappingKeys, featurePoint, newProperties) }) @@ -135,7 +136,7 @@ export default class { let originalValue = featurePoint.properties[pointKeyName] let mappingValueObject: any = ''; - if (mappingKeys.indexOf(pointKeyName) > 0) { + if (mappingKeys.indexOf(pointKeyName) !== -1) { mappingValueObject = this.mapping_config.tags[pointKeyName] debugLog('convertProperty: mappingValueObject ', mappingValueObject) } @@ -147,13 +148,14 @@ export default class { /** * add all unmapped tags is enabled */ + debugLog(' ------ add all unmapped tags is enabled') newProperties[pointKeyName] = originalValue; } else { /** * only use existing keys */ - if (mappingKeys.indexOf(pointKeyName) > 0) { + if (mappingKeys.indexOf(pointKeyName) !== -1) { let valueConvertedFromMapping = featurePoint.properties[pointKeyName] let keyConvertedFromMapping = mappingKeys[mappingKeys.indexOf(pointKeyName)] let mappingConfigOfTag = this.mapping_config.tags[pointKeyName] @@ -329,6 +331,8 @@ export default class { newProperties[newKey] = convertedValue.trim() } } + }else{ + debugLog('!!!!!! property not found in mappingKeys: ', pointKeyName) } } diff --git a/mappings/utils.ts b/mappings/utils.ts index 2fd973c..ffbe99f 100644 --- a/mappings/utils.ts +++ b/mappings/utils.ts @@ -12,7 +12,8 @@ let output_folder = 'output'; */ function debugLog(...args: any[]) { if (show_debug) { - console.log('### debug: ', ...args) + console.log('### debug: ',) + args.map((elem: any) => console.log(' ',elem)) } } diff --git a/output/my_converted_data_set.json b/output/my_converted_data_set.json index ee3535c..149f6ab 100644 --- a/output/my_converted_data_set.json +++ b/output/my_converted_data_set.json @@ -10,7 +10,9 @@ 45.635079 ] }, - "properties": {} + "properties": { + "name": "Bob" + } } ] } \ No newline at end of file