up percent of change in points
This commit is contained in:
parent
cb87b60c48
commit
ad68cbdb9e
@ -15,6 +15,7 @@ import utils from './mappings/utils'
|
||||
import mappingRouenParkingVelos from "./mappings/converters/configRouen_OpenData_velo_parkings";
|
||||
import mappingFINESS from "./mappings/converters/configFINESS";
|
||||
|
||||
const limitWarningPercentageChangeInPoints = 5; // show a warning when more than N percent of the number of points changed
|
||||
const allowed_configs = ['mappingIssy2Roues', 'mappingConfigIRVE', 'mappingConfigIRVEFromOsmose', 'mappingConfigIRVE_simple', 'mappingTest', 'ConfigIRVE', 'mappingRouenParkingVelos','mappingFINESS'];
|
||||
|
||||
const minimist = require('minimist')
|
||||
@ -171,13 +172,12 @@ function convertDataFromSource(sourceFilePath: string, mapping: MappingConfigTyp
|
||||
list_of_points = list_of_points.splice(0, mapping.filters.offset)
|
||||
}
|
||||
|
||||
console.log('list_of_points.length', list_of_points.length)
|
||||
console.log('features count before:', list_of_points.length)
|
||||
|
||||
|
||||
/**
|
||||
* filtering
|
||||
* run filters before mapping OSM tags
|
||||
* TODO: do it in the engine
|
||||
*/
|
||||
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)
|
||||
@ -278,16 +278,18 @@ function convertDataFromSource(sourceFilePath: string, mapping: MappingConfigTyp
|
||||
}
|
||||
let fileNameToWrite = '_' + filteredName + output_supplement + '.geojson'
|
||||
console.log('converted features:', converted_geo_json.features.length)
|
||||
console.log('diff: ', data_transformed.features.length - converted_geo_json.features.length)
|
||||
let percentChange = 100 - ((1 - (data_transformed.features.length / converted_geo_json.features.length)) * -1)
|
||||
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;
|
||||
console.log('Changement de features', percentChange, '%')
|
||||
if (percentChange > 5) {
|
||||
|
||||
if (percentChange > limitWarningPercentageChangeInPoints) {
|
||||
console.log(' /!\\ pas mal de points en moins, plus de ' + percentChange + '%')
|
||||
}
|
||||
debugLog('convert : write file ', fileNameToWrite)
|
||||
|
||||
// console.log('mapping_engine.stats', Mapping_engine.stats)
|
||||
console.log('mapping config name', Mapping_engine.getConfig().config_name)
|
||||
console.log('mapping config name:', Mapping_engine.getConfig().config_name)
|
||||
writeFile(fileNameToWrite, JSON.stringify(converted_geo_json, null, 2))
|
||||
|
||||
} else {
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user