improve finding keys
This commit is contained in:
parent
2cb019ff5c
commit
d136015f5e
@ -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
|
||||
|
@ -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 <contact@cipherbliss.com>',
|
||||
default_properties_of_point: {},
|
||||
tags: {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,9 @@
|
||||
45.635079
|
||||
]
|
||||
},
|
||||
"properties": {}
|
||||
"properties": {
|
||||
"name": "Bob"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user