convert from engine simple values

This commit is contained in:
Tykayn 2023-08-05 12:05:52 +02:00 committed by tykayn
parent c53e3872a6
commit 092798f4b1
3 changed files with 13 additions and 10 deletions

View File

@ -73,7 +73,7 @@ export default class {
// }
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 filteredList
@ -126,18 +126,20 @@ export default class {
*/
convertProperty(pointKeyName: string, mappingKeys: any, featurePoint: any, newProperties: any) {
debugLog('convertProperty: pointKeyName', pointKeyName)
debugLog('convertProperty: mappingKeys', mappingKeys)
if (mappingKeys.indexOf(pointKeyName) !== -1) {
debugLog('convertProperty: found element', pointKeyName, '=>', this.mapping_config[pointKeyName], 'value : ', featurePoint.properties[pointKeyName])
// debugLog('convertProperty: mappingKeys', mappingKeys)
if (mappingKeys.indexOf(pointKeyName) > 0) {
let valueConvertedFromMapping = featurePoint.properties[pointKeyName]
let keyConvertedFromMapping = mappingKeys[mappingKeys.indexOf(pointKeyName)]
debugLog('convertProperty: found element', pointKeyName, '=>', keyConvertedFromMapping, 'value : ', valueConvertedFromMapping)
let convertedValue = ''
let valueConvertedFromMapping = featurePoint.properties[pointKeyName]
let typeofValue = typeof valueConvertedFromMapping
let isStringValue = typeofValue === 'string'
debugLog('convertProperty: - typeofValue', typeofValue)
debugLog('convertProperty: - pointKeyName', pointKeyName)
debugLog('convertProperty: - valueConvertedFromMapping', valueConvertedFromMapping)
// debugLog('typeof featurePoint.properties[pointKeyName] === \'string\'', typeofValue)
debugLog('typeof valueConvertedFromMapping === \'string\'', typeofValue)
let isConfigMappingObject = typeofValue === 'string'
@ -154,7 +156,7 @@ export default class {
}
debugLog('convertProperty: -- convertedValue', convertedValue)
if (convertedValue) {
newProperties[this.mapping_config[pointKeyName]] = convertedValue
newProperties[keyConvertedFromMapping] = convertedValue
}
} else if (isConfigMappingObject) {
debugLog('convertProperty: is config object')

View File

@ -1,7 +1,7 @@
import fs from 'fs'
let show_debug = 0
// show_debug = 1
show_debug = 1
let output_folder = 'output';
console.log('----------------------show_debug', show_debug)
@ -12,7 +12,7 @@ console.log('----------------------show_debug', show_debug)
*/
function debugLog(...args: any[]) {
if (show_debug) {
// console.log('### debug: ', ...args)
console.log('### debug: ', ...args)
}
}

View File

@ -11,7 +11,8 @@
]
},
"properties": {
"undefined": "891624884"
"nom_amenageur": "ELECTRA",
"siren_amenageur": "891624884"
}
}
]