diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml
new file mode 100644
index 0000000..db41336
--- /dev/null
+++ b/.idea/dbnavigator.xml
@@ -0,0 +1,404 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..03d9549
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/prettier.xml b/.idea/prettier.xml
new file mode 100644
index 0000000..0c83ac4
--- /dev/null
+++ b/.idea/prettier.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/convert_to_osm_tags.ts b/convert_to_osm_tags.ts
index beaef46..68f093a 100644
--- a/convert_to_osm_tags.ts
+++ b/convert_to_osm_tags.ts
@@ -210,8 +210,13 @@ function convertDataFromSource(sourceFilePath: string, mapping: MappingConfigTyp
* filtering
* run filters before mapping OSM tags
*/
- if (mapping.filters && mapping.filters.exclude_point_if_tag_not_empty) {
- list_of_points = Mapping_engine.filterListOfPointsByExcludingIfKeyFilled(list_of_points, mapping.filters.exclude_point_if_tag_not_empty)
+ if (mapping.filters) {
+ if (mapping.filters.exclude_point_if_tag_not_empty) {
+ list_of_points = Mapping_engine.filterListOfPointsByExcludingIfKeyFilled(list_of_points, mapping.filters.exclude_point_if_tag_not_empty)
+ }
+ if (mapping.filters.filter_points_lesser_than_NkW) {
+ list_of_points = Mapping_engine.filterListOfPointsByExcludingIfMaxPowerIsLesserThan(mapping.filters.filter_points_lesser_than_NkW, list_of_points)
+ }
}
// for each point from the data source, filter if we take it or not
@@ -361,7 +366,7 @@ function convertDataFromSource(sourceFilePath: string, mapping: MappingConfigTyp
console.log('converted features:', converted_geo_json.features.length)
console.log('différences nombre de features: ', data_transformed.features.length - converted_geo_json.features.length)
- const percentChange = (data_transformed.features.length - converted_geo_json.features.length) / converted_geo_json.features.length * 100;
+ const percentChange = (data_transformed.features.length) / converted_geo_json.features.length * 100;
console.log('Changement de features', percentChange, '%')
if (percentChange > limitWarningPercentageChangeInPoints) {
diff --git a/mappings/converters/configIRVE.ts b/mappings/converters/configIRVE.ts
index 9e7c9c8..3316892 100644
--- a/mappings/converters/configIRVE.ts
+++ b/mappings/converters/configIRVE.ts
@@ -21,6 +21,7 @@ const MappingIRVE: MappingConfigType = {
filters: {
enable_coordinates_filter: false,
enable_properties_filter: true,
+ filter_points_lesser_than_NkW: 50
// add only geojson points who are found having this regex in the zipcode properties
// properties: {
// consolidated_code_postal: '^[76|27]'
@@ -74,7 +75,7 @@ const MappingIRVE: MappingConfigType = {
{
key_converted: 'authentication:none',
convert_to_boolean_value: true, // convertit en yes ou no
-
+
},
reservation: {
convert_to_boolean_value: true, // convertit en yes ou no
diff --git a/mappings/engine.ts b/mappings/engine.ts
index afc4d89..250a25b 100644
--- a/mappings/engine.ts
+++ b/mappings/engine.ts
@@ -22,8 +22,10 @@ function boolToAddable(someBooleanValue: boolean) {
export default class {
mapping_config: any = {}
- private jardinage = false;
public stats: any;
+ truthyValues = [true, 'true', 'True', 'TRUE', '1', 'yes', 1]
+ falsyValues = [false, 'false', 'False', 'FALSE', '0', 'no', 0]
+ private jardinage = false;
private current_converted_geojson_point: any;
private current_geojson_point: any; // currently converting point
private list_of_points: any; // list of geojson points
@@ -74,9 +76,6 @@ export default class {
return listOfBooleanKeys.indexOf(pointKeyName) !== -1
}
- truthyValues = [true, 'true', 'True', 'TRUE', '1', 'yes', 1]
- falsyValues = [false, 'false', 'False', 'FALSE', '0', 'no', 0]
-
/**
* filter: reduce number of features
* @param offsetCount
@@ -131,6 +130,23 @@ export default class {
return newList;
}
+ filterListOfPointsByExcludingIfMaxPowerIsLesserThan(minValue: number, list_of_points: any[]): any[] {
+ let newList: any[] = []
+ list_of_points.forEach((geojsonPoint: any) => {
+ let pointProperties = Object.keys(geojsonPoint.properties)
+ // trouver la valeur
+ // socket_output_find_correspondances
+ if (pointProperties.includes('puissance_nominale') &&
+ 1 * (geojsonPoint.properties['puissance_nominale'].replace(' kW', '')) > minValue
+ ) {
+ newList.push(geojsonPoint)
+ }
+ })
+
+ return newList;
+
+ }
+
/**
* retuns the converted element from mapping config if present, null otherwise
*/
@@ -437,7 +453,7 @@ export default class {
} else {
this.stats.phones_not_updated++
}
- debugLog('convertedValue convert_to_phone', originalValue ,'=>', convertedValue)
+ debugLog('convertedValue convert_to_phone', originalValue, '=>', convertedValue)
}
if (configObject.convert_to_name) {
@@ -540,7 +556,7 @@ export default class {
hasKeyIgnoreThisData = (keysOfConfigObject.indexOf('ignore_this_data') !== -1)
}
- debugLog('remove_original_key && newKey && convertedValue && hasKeyIgnoreThisData', remove_original_key , newKey , convertedValue ,hasKeyIgnoreThisData)
+ debugLog('remove_original_key && newKey && convertedValue && hasKeyIgnoreThisData', remove_original_key, newKey, convertedValue, hasKeyIgnoreThisData)
if (!remove_original_key && newKey && convertedValue && !hasKeyIgnoreThisData
) {
debugLog('convertedValue', convertedValue)
diff --git a/mappings/mapping-config.type.ts b/mappings/mapping-config.type.ts
index 6225c75..11a1e8f 100644
--- a/mappings/mapping-config.type.ts
+++ b/mappings/mapping-config.type.ts
@@ -33,7 +33,8 @@ export interface filteringConfig {
enable_properties_filter?: boolean;
properties?: object;
bounding_box?: object;
- offset?:number;
+ offset?: number;
+ filter_points_lesser_than_NkW?: number; // filtrer les points qui ont moins de N kW dans la clé de puissance max
exclude_point_if_tag_not_empty?: Array;
exclude_point_if_tag_truthy?: Array;
exclude_point_if_tag_falsy?: Array;
@@ -63,8 +64,6 @@ export default interface MappingConfigType {
* configuration concernant toutes les valeurs
*/
export interface FeaturePropertyMappingConfigType {
- [key: string]: any,
-
convert_to_boolean_value?: boolean,
invert_boolean_value?: boolean,
remove_original_key?: boolean,
@@ -74,6 +73,8 @@ export interface FeaturePropertyMappingConfigType {
ignore_if_truthy?: boolean,
conditional_values?: ConditionnalValuesConfigType,
transform_function?: Function,
+
+ [key: string]: any,
}
/**