convert from engine simple values
This commit is contained in:
parent
c53e3872a6
commit
092798f4b1
|
@ -73,7 +73,7 @@ export default class {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
filterFeaturesByPropertyRegex(propertyName: string, criteriaRegex: any, listOfFeatures: any) {
|
filterFeaturesByPropertyRegex(propertyName: string, criteriaRegex: any, listOfFeatures: any) {
|
||||||
let filteredList = listOfFeatures.filter((feature:any) => {
|
let filteredList = listOfFeatures.filter((feature: any) => {
|
||||||
return criteriaRegex.test(feature?.properties[propertyName])
|
return criteriaRegex.test(feature?.properties[propertyName])
|
||||||
})
|
})
|
||||||
return filteredList
|
return filteredList
|
||||||
|
@ -126,18 +126,20 @@ export default class {
|
||||||
*/
|
*/
|
||||||
convertProperty(pointKeyName: string, mappingKeys: any, featurePoint: any, newProperties: any) {
|
convertProperty(pointKeyName: string, mappingKeys: any, featurePoint: any, newProperties: any) {
|
||||||
debugLog('convertProperty: pointKeyName', pointKeyName)
|
debugLog('convertProperty: pointKeyName', pointKeyName)
|
||||||
debugLog('convertProperty: mappingKeys', mappingKeys)
|
// debugLog('convertProperty: mappingKeys', mappingKeys)
|
||||||
if (mappingKeys.indexOf(pointKeyName) !== -1) {
|
if (mappingKeys.indexOf(pointKeyName) > 0) {
|
||||||
debugLog('convertProperty: found element', pointKeyName, '=>', this.mapping_config[pointKeyName], 'value : ', featurePoint.properties[pointKeyName])
|
let valueConvertedFromMapping = featurePoint.properties[pointKeyName]
|
||||||
|
let keyConvertedFromMapping = mappingKeys[mappingKeys.indexOf(pointKeyName)]
|
||||||
|
|
||||||
|
debugLog('convertProperty: found element', pointKeyName, '=>', keyConvertedFromMapping, 'value : ', valueConvertedFromMapping)
|
||||||
let convertedValue = ''
|
let convertedValue = ''
|
||||||
|
|
||||||
let valueConvertedFromMapping = featurePoint.properties[pointKeyName]
|
|
||||||
let typeofValue = typeof valueConvertedFromMapping
|
let typeofValue = typeof valueConvertedFromMapping
|
||||||
let isStringValue = typeofValue === 'string'
|
let isStringValue = typeofValue === 'string'
|
||||||
debugLog('convertProperty: - typeofValue', typeofValue)
|
debugLog('convertProperty: - typeofValue', typeofValue)
|
||||||
debugLog('convertProperty: - pointKeyName', pointKeyName)
|
debugLog('convertProperty: - pointKeyName', pointKeyName)
|
||||||
debugLog('convertProperty: - valueConvertedFromMapping', valueConvertedFromMapping)
|
debugLog('convertProperty: - valueConvertedFromMapping', valueConvertedFromMapping)
|
||||||
// debugLog('typeof featurePoint.properties[pointKeyName] === \'string\'', typeofValue)
|
debugLog('typeof valueConvertedFromMapping === \'string\'', typeofValue)
|
||||||
|
|
||||||
let isConfigMappingObject = typeofValue === 'string'
|
let isConfigMappingObject = typeofValue === 'string'
|
||||||
|
|
||||||
|
@ -154,7 +156,7 @@ export default class {
|
||||||
}
|
}
|
||||||
debugLog('convertProperty: -- convertedValue', convertedValue)
|
debugLog('convertProperty: -- convertedValue', convertedValue)
|
||||||
if (convertedValue) {
|
if (convertedValue) {
|
||||||
newProperties[this.mapping_config[pointKeyName]] = convertedValue
|
newProperties[keyConvertedFromMapping] = convertedValue
|
||||||
}
|
}
|
||||||
} else if (isConfigMappingObject) {
|
} else if (isConfigMappingObject) {
|
||||||
debugLog('convertProperty: is config object')
|
debugLog('convertProperty: is config object')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
|
||||||
let show_debug = 0
|
let show_debug = 0
|
||||||
// show_debug = 1
|
show_debug = 1
|
||||||
let output_folder = 'output';
|
let output_folder = 'output';
|
||||||
|
|
||||||
console.log('----------------------show_debug', show_debug)
|
console.log('----------------------show_debug', show_debug)
|
||||||
|
@ -12,7 +12,7 @@ console.log('----------------------show_debug', show_debug)
|
||||||
*/
|
*/
|
||||||
function debugLog(...args: any[]) {
|
function debugLog(...args: any[]) {
|
||||||
if (show_debug) {
|
if (show_debug) {
|
||||||
// console.log('### debug: ', ...args)
|
console.log('### debug: ', ...args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"undefined": "891624884"
|
"nom_amenageur": "ELECTRA",
|
||||||
|
"siren_amenageur": "891624884"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue