diff --git a/mapping_geojson_to_osm_tags/convert_to_osm_tags.js b/mapping_geojson_to_osm_tags/convert_to_osm_tags.js new file mode 100644 index 00000000..c4f1c520 --- /dev/null +++ b/mapping_geojson_to_osm_tags/convert_to_osm_tags.js @@ -0,0 +1,184 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * convertisseur de données de bornes de recharge électrique à partir de données Chargemap et open data Etalab + */ +var fs = require("fs"); +var minimist = require("minimist"); +var configIRVE_1 = require("./mappings/converters/configIRVE"); +var mappingConfigIRVE_simple_1 = require("./mappings/converters/mappingConfigIRVE_simple"); +var engine_1 = require("./mappings/engine"); +var utils_ts_1 = require("./mappings/utils.ts"); +var debugLog = utils_ts_1.default.debugLog; +var use_mappping_engine = false; +use_mappping_engine = true; +var Mapping_engine = new engine_1.default(configIRVE_1.default); +var mini_arguments = minimist(process.argv.slice(2)); +var sourceFilePathGeoJson = './etalab_data/small.json'; +// wip filter +var filterOnBoundingBox = true; +filterOnBoundingBox = false; +var boundingBoxCoordinates = { + xMin: 1.91, + xMax: 2.38, + yMin: 48.7, + yMax: 48.4, +}; +var filterCoordinates = true; +var enable_filter_on_department = true; +enable_filter_on_department = false; +var filterDepartment = 91; +if (mini_arguments['department']) { + filterDepartment = mini_arguments['department']; + enable_filter_on_department = true; +} +if (mini_arguments['source']) { + sourceFilePathGeoJson = mini_arguments['source']; +} +if (mini_arguments['engine']) { + use_mappping_engine = mini_arguments['engine']; +} +var filterZipCode = new RegExp("^".concat(filterDepartment)); +var filterZipCodeAdresse = new RegExp(" ".concat(filterDepartment)); +var filteredName = ''; +if (enable_filter_on_department) { + filteredName = '_filtered_zipcode_' + filterDepartment; +} +else if (filterOnBoundingBox) { + filteredName = '_filtered_bbox_' + boundingBoxCoordinates.xMin + '-' + boundingBoxCoordinates.xMax + '_' + boundingBoxCoordinates.yMin + '-' + boundingBoxCoordinates.yMax; +} +var pointCounterMax = 1000000; +var limitConversionToFirstPoint = false; +// limitConversionToFirstPoint = true +if (limitConversionToFirstPoint) { + pointCounterMax = 1; +} +var defaultPropertiesOfPoint = { + 'amenity': 'charging_station' +}; +var converted_geo_json = { + type: 'FeatureCollection', + features: [] +}; +/** + * + * @param sourceFilePath + * @param mapping + * @param pointCounterMax + * @param boundingBoxCoordinates + */ +function convertDataForIRVE(sourceFilePath, mapping, pointCounterMax, boundingBoxCoordinates) { + debugLog('convertDataFromChargemap from ', sourceFilePath); + fs.readFile(sourceFilePath, 'utf8', function (err, data) { + var point_counter = 0; + if (err) { + return debugLog(err); + } + var data_transformed = JSON.parse(data); + // debug('data keys ', Object.keys(dataTransformed)) + debugLog('debug: properties of point 0', data_transformed.features[0]); + if (data_transformed.features) { + debugLog('data found, features:', data_transformed.features.length); + // find interesting list of points to use + var list_of_points = data_transformed.features; + // for each point from the data source, convert with the mapping + console.log('listOfPoints.length', list_of_points.length); + list_of_points.forEach(function (feature_point) { + var regex_filter_test_result = true; + if (enable_filter_on_department) { + debugLog('filtre sur les départements activé'); + regex_filter_test_result = (filterZipCode.test(feature_point.properties.consolidated_code_postal) + || + filterZipCodeAdresse.test(feature_point.properties.adresse_station)); + } + else if (filterOnBoundingBox) { + debugLog('filtre sur les coordonnées activé'); + var x = feature_point.properties.coordonneesXY[0]; + var xMin = boundingBoxCoordinates.xMin; + var xMax = boundingBoxCoordinates.xMax; + var yMin = boundingBoxCoordinates.yMin; + var yMax = boundingBoxCoordinates.yMax; + var y = feature_point.properties.coordonneesXY[1]; + regex_filter_test_result = ((x >= xMin && x <= xMax) + && + (y >= yMin && y <= yMax)); + } + // filter points depending on zipcode + if (filterCoordinates && regex_filter_test_result) { + debugLog('featurePoint.properties.consolidated_code_postal', feature_point.properties.consolidated_code_postal); + // limit results number of points + // if (pointcounter < pointCounterMax) { + debugLog('add point'); + debugLog('featurePoint', feature_point); + var mapped_point = {}; + if (use_mappping_engine) { + mapped_point = Mapping_engine.mapElementFromConf(feature_point); + } + else { + mapped_point = mapElementFromConfSimple(feature_point, mapping); + } + debugLog('map one point', feature_point, mapped_point); + if (mapped_point) { + converted_geo_json.features.push(mapped_point); + } + } + // } + point_counter++; + }); + // output new geojson + console.log('convertedGeoJson.features.length', converted_geo_json.features.length); + // write file on disk + var fileNameToWrite = 'my_converted_data_set' + filteredName + '.json'; + console.log('write file ', fileNameToWrite); + utils_ts_1.default.writeFile(fileNameToWrite, JSON.stringify(converted_geo_json, null, 2)); + debugLog('mapped output:', converted_geo_json.features); + return converted_geo_json; + } + }); +} +/** + * retuns the converted element from mapping config if present, null otherwise + */ +function mapElementFromConfSimple(featurePoint, mappingConfig) { + var mappingKeys = Object.keys(mappingConfig); + var featurePointPropertiesKeys = Object.keys(featurePoint.properties); + debugLog('keys', mappingKeys, featurePointPropertiesKeys); + var newProperties = defaultPropertiesOfPoint; + // reinit properties of current point + var basePoint = Object.create(featurePoint); + basePoint.type = featurePoint.type; + basePoint.geometry = featurePoint.geometry; + basePoint.properties = newProperties; + // apply new properties if found in mapping config + featurePointPropertiesKeys.forEach(function (pointKeyName) { + if (mappingKeys.indexOf(pointKeyName) !== -1) { + debugLog('found element', pointKeyName, '=>', mappingConfig[pointKeyName], 'value : ', featurePoint.properties[pointKeyName]); + var convertedValue = ''; + if (utils_ts_1.default.isBooleanKey(pointKeyName)) { + var copyOfValue = '' + featurePoint.properties[pointKeyName]; + if (typeof copyOfValue === typeof Object && copyOfValue.key_converted) { + copyOfValue = copyOfValue.key_converted; + } + convertedValue = copyOfValue.toLowerCase() == 'true' ? 'yes' : 'no'; + } + else { + convertedValue = featurePoint.properties[pointKeyName]; + } + if (convertedValue) { + newProperties[mappingConfig[pointKeyName]] = convertedValue; + } + } + }); + debugLog('basePoint', basePoint); + return basePoint; +} +if (use_mappping_engine) { + console.log(' - using mapping engine'); + console.log(' - pointCounterMax', pointCounterMax); + Mapping_engine.setConfig(configIRVE_1.default); + convertDataForIRVE(sourceFilePathGeoJson, configIRVE_1.default, pointCounterMax, boundingBoxCoordinates); +} +else { + configIRVE_1.default = mappingConfigIRVE_simple_1.default; + convertDataForIRVE(sourceFilePathGeoJson, configIRVE_1.default, pointCounterMax, boundingBoxCoordinates); +} diff --git a/mapping_geojson_to_osm_tags/convert_to_osm_tags.ts b/mapping_geojson_to_osm_tags/convert_to_osm_tags.ts index f9ccc51c..cac41a23 100644 --- a/mapping_geojson_to_osm_tags/convert_to_osm_tags.ts +++ b/mapping_geojson_to_osm_tags/convert_to_osm_tags.ts @@ -1,14 +1,14 @@ /** * convertisseur de données de bornes de recharge électrique à partir de données Chargemap et open data Etalab */ -import fs from 'node' -import * as minimist from 'minimist' +import * as fs from 'fs' + import mappingConfigIRVE from './mappings/converters/configIRVE' import mappingConfigIRVE_simple from './mappings/converters/mappingConfigIRVE_simple' import mapping_engine from './mappings/engine' -import custom_utils from './mappings/utils' -import MappingConfigType, {BoundingBoxCoordinatesType} from "./mappings/mapping-config.type"; -import utils from './mappings/utils.ts' +import MappingConfigType, {BoundingBoxCoordinatesType, FeatureCollection} from "./mappings/mapping-config.type"; +import utils from './mappings/utils' +const minimist = require('minimist') const debugLog = utils.debugLog; @@ -17,7 +17,7 @@ use_mappping_engine = true let Mapping_engine = new mapping_engine(mappingConfigIRVE) -let mini_arguments = minimist(process.argv.slice(2)) +let mini_arguments: any = minimist(process.argv.slice(2)) let sourceFilePathGeoJson = './etalab_data/small.json' @@ -26,11 +26,11 @@ let sourceFilePathGeoJson = './etalab_data/small.json' let filterOnBoundingBox = true filterOnBoundingBox = false -let boundingBoxCoordinates : BoundingBoxCoordinatesType = { - xMin: 1.91, - xMax: 2.38, - yMin: 48.7, - yMax: 48.4, +let boundingBoxCoordinates: BoundingBoxCoordinatesType = { + xMin: 1.91, + xMax: 2.38, + yMin: 48.7, + yMax: 48.4, } let filterCoordinates = true @@ -39,14 +39,14 @@ enable_filter_on_department = false let filterDepartment = 91 if (mini_arguments['department']) { - filterDepartment = mini_arguments['department'] - enable_filter_on_department = true + filterDepartment = mini_arguments['department'] + enable_filter_on_department = true } if (mini_arguments['source']) { - sourceFilePathGeoJson = mini_arguments['source'] + sourceFilePathGeoJson = mini_arguments['source'] } if (mini_arguments['engine']) { - use_mappping_engine = mini_arguments['engine'] + use_mappping_engine = mini_arguments['engine'] } let filterZipCode = new RegExp(`^${filterDepartment}`) @@ -54,25 +54,25 @@ let filterZipCodeAdresse = new RegExp(` ${filterDepartment}`) let filteredName = '' if (enable_filter_on_department) { - filteredName = '_filtered_zipcode_' + filterDepartment + filteredName = '_filtered_zipcode_' + filterDepartment } else if (filterOnBoundingBox) { - filteredName = '_filtered_bbox_' + boundingBoxCoordinates.xMin + '-' + boundingBoxCoordinates.xMax + '_' + boundingBoxCoordinates.yMin + '-' + boundingBoxCoordinates.yMax + filteredName = '_filtered_bbox_' + boundingBoxCoordinates.xMin + '-' + boundingBoxCoordinates.xMax + '_' + boundingBoxCoordinates.yMin + '-' + boundingBoxCoordinates.yMax } -let pointCounterMax = 1000000 +let pointCounterMax :number = 1000000 -let limitConversionToFirstPoint = false +let limitConversionToFirstPoint :boolean = false // limitConversionToFirstPoint = true if (limitConversionToFirstPoint) { - pointCounterMax = 1 + pointCounterMax = 1 } -let defaultPropertiesOfPoint = { - 'amenity': 'charging_station' +let defaultPropertiesOfPoint :any= { + 'amenity': 'charging_station' } -let converted_geo_json = { - type: 'FeatureCollection', - features: [] +let converted_geo_json :any = { + type: 'FeatureCollection', + features: [] } /** @@ -82,152 +82,153 @@ let converted_geo_json = { * @param pointCounterMax * @param boundingBoxCoordinates */ -function convertDataForIRVE (sourceFilePath, mapping: MappingConfigType, pointCounterMax, boundingBoxCoordinates) { - debugLog('convertDataFromChargemap from ', sourceFilePath) +function convertDataForIRVE(sourceFilePath: string, mapping: MappingConfigType, pointCounterMax: number, boundingBoxCoordinates: any) { + debugLog('convertDataFromChargemap from ', sourceFilePath) - fs.readFile(sourceFilePath, 'utf8', function (err, data) { - let point_counter = 0 - if (err) { - return debugLog(err) - } - let data_transformed = JSON.parse(data) - // debug('data keys ', Object.keys(dataTransformed)) + fs.readFile(sourceFilePath, 'utf8', function (err, data) { + let point_counter = 0 + if (err) { + return debugLog(err) + } + let data_transformed: FeatureCollection = JSON.parse(data) + // debug('data keys ', Object.keys(dataTransformed)) - debugLog('debug: properties of point 0', data_transformed.features[0]) - if (data_transformed.features) { + debugLog('debug: properties of point 0', data_transformed.features[0]) + if (data_transformed.features) { - debugLog('data found, features:', data_transformed.features.length) + debugLog('data found, features:', data_transformed.features.length) - // find interesting list of points to use - let list_of_points = data_transformed.features - // for each point from the data source, convert with the mapping + // find interesting list of points to use + let list_of_points : any = data_transformed.features + // for each point from the data source, convert with the mapping - console.log('listOfPoints.length', list_of_points.length) - list_of_points.forEach(feature_point => { + console.log('listOfPoints.length', list_of_points.length) + list_of_points.forEach((feature_point: any) => { - let regex_filter_test_result = true + let regex_filter_test_result = true - if (enable_filter_on_department) { - debugLog('filtre sur les départements activé') - regex_filter_test_result = ( - filterZipCode.test(feature_point.properties.consolidated_code_postal) - || - filterZipCodeAdresse.test(feature_point.properties.adresse_station) - ) - } else if (filterOnBoundingBox) { - debugLog('filtre sur les coordonnées activé') + if (enable_filter_on_department) { + debugLog('filtre sur les départements activé') + regex_filter_test_result = ( + filterZipCode.test(feature_point.properties.consolidated_code_postal) + || + filterZipCodeAdresse.test(feature_point.properties.adresse_station) + ) + } + else if (filterOnBoundingBox) { + debugLog('filtre sur les coordonnées activé') - let x = feature_point.properties.coordonneesXY[0] - let xMin = boundingBoxCoordinates.xMin - let xMax = boundingBoxCoordinates.xMax - let yMin = boundingBoxCoordinates.yMin - let yMax = boundingBoxCoordinates.yMax + let x = feature_point.properties.coordonneesXY[0] + let xMin = boundingBoxCoordinates.xMin + let xMax = boundingBoxCoordinates.xMax + let yMin = boundingBoxCoordinates.yMin + let yMax = boundingBoxCoordinates.yMax - let y = feature_point.properties.coordonneesXY[1] - regex_filter_test_result = ( - (x >= xMin && x <= xMax) - && - (y >= yMin && y <= yMax) - ) + let y = feature_point.properties.coordonneesXY[1] + regex_filter_test_result = ( + (x >= xMin && x <= xMax) + && + (y >= yMin && y <= yMax) + ) - } + } - // filter points depending on zipcode - if (filterCoordinates && regex_filter_test_result) { + // filter points depending on zipcode + if (filterCoordinates && regex_filter_test_result) { - debugLog('featurePoint.properties.consolidated_code_postal', feature_point.properties.consolidated_code_postal) + debugLog('featurePoint.properties.consolidated_code_postal', feature_point.properties.consolidated_code_postal) - // limit results number of points - // if (pointcounter < pointCounterMax) { + // limit results number of points + // if (pointcounter < pointCounterMax) { - debugLog('add point') + debugLog('add point') - debugLog('featurePoint', feature_point) + debugLog('featurePoint', feature_point) - let mapped_point = {} + let mapped_point: any = {} - if (use_mappping_engine) { - mapped_point = Mapping_engine.mapElementFromConf(feature_point) - } else { - mapped_point = mapElementFromConfSimple(feature_point, mapping) - } - debugLog('map one point', feature_point, mapped_point) - if (mapped_point) { - converted_geo_json.features.push(mapped_point) - } - } - // } - point_counter++ + if (use_mappping_engine) { + mapped_point = Mapping_engine.mapElementFromConf(feature_point) + } else { + mapped_point = mapElementFromConfSimple(feature_point, mapping) + } + debugLog('map one point', feature_point, mapped_point) + if (mapped_point) { + converted_geo_json.features.push(mapped_point) + } + } + // } + point_counter++ - }) - // output new geojson - console.log('convertedGeoJson.features.length', converted_geo_json.features.length) - // write file on disk - let fileNameToWrite = 'my_converted_data_set' + filteredName + '.json' - console.log('write file ', fileNameToWrite) - utils.writeFile(fileNameToWrite, JSON.stringify(converted_geo_json, null, 2)) + }) + // output new geojson + console.log('convertedGeoJson.features.length', converted_geo_json.features.length) + // write file on disk + let fileNameToWrite = 'my_converted_data_set' + filteredName + '.json' + console.log('write file ', fileNameToWrite) + utils.writeFile(fileNameToWrite, JSON.stringify(converted_geo_json, null, 2)) - debugLog('mapped output:', converted_geo_json.features) + debugLog('mapped output:', converted_geo_json.features) - return converted_geo_json - } - }) + return converted_geo_json + } + }) } /** * retuns the converted element from mapping config if present, null otherwise */ -function mapElementFromConfSimple (featurePoint, mappingConfig) { - let mappingKeys = Object.keys(mappingConfig) - let featurePointPropertiesKeys = Object.keys(featurePoint.properties) +function mapElementFromConfSimple(featurePoint: any, mappingConfig: MappingConfigType) { + let mappingKeys = Object.keys(mappingConfig) + let featurePointPropertiesKeys = Object.keys(featurePoint.properties) - debugLog('keys', mappingKeys, featurePointPropertiesKeys) + debugLog('keys', mappingKeys, featurePointPropertiesKeys) - let newProperties = defaultPropertiesOfPoint + let newProperties :any = defaultPropertiesOfPoint - // reinit properties of current point - let basePoint = Object.create(featurePoint) - basePoint.type = featurePoint.type - basePoint.geometry = featurePoint.geometry - basePoint.properties = newProperties + // reinit properties of current point + let basePoint = Object.create(featurePoint) + basePoint.type = featurePoint.type + basePoint.geometry = featurePoint.geometry + basePoint.properties = newProperties - // apply new properties if found in mapping config - featurePointPropertiesKeys.forEach(pointKeyName => { + // apply new properties if found in mapping config + featurePointPropertiesKeys.forEach((pointKeyName: string) => { - if (mappingKeys.indexOf(pointKeyName) !== -1) { - debugLog('found element', pointKeyName, '=>', mappingConfig[pointKeyName], 'value : ', featurePoint.properties[pointKeyName]) - let convertedValue = '' - if ( utils.isBooleanKey(pointKeyName)) { + if (mappingKeys.indexOf(pointKeyName) !== -1) { + debugLog('found element', pointKeyName, '=>', mappingConfig[pointKeyName], 'value : ', featurePoint.properties[pointKeyName]) + let convertedValue: any = '' + if (utils.isBooleanKey(pointKeyName)) { - let copyOfValue :any = '' + featurePoint.properties[pointKeyName] - if (typeof copyOfValue === typeof Object && copyOfValue.key_converted) { - copyOfValue = copyOfValue.key_converted - } - convertedValue = copyOfValue.toLowerCase() == 'true' ? 'yes' : 'no' - } else { - convertedValue = featurePoint.properties[pointKeyName] - } + let copyOfValue: any = '' + featurePoint.properties[pointKeyName] + if (typeof copyOfValue === typeof Object && copyOfValue.key_converted) { + copyOfValue = copyOfValue.key_converted + } + convertedValue = copyOfValue.toLowerCase() == 'true' ? 'yes' : 'no' + } else { + convertedValue = featurePoint.properties[pointKeyName] + } - if (convertedValue) { - newProperties[mappingConfig[pointKeyName]] = convertedValue - } - } - }) + if (convertedValue) { + newProperties[mappingConfig[pointKeyName]] = convertedValue + } + } + }) - debugLog('basePoint', basePoint) - return basePoint + debugLog('basePoint', basePoint) + return basePoint } if (use_mappping_engine) { - console.log(' - using mapping engine') - console.log(' - pointCounterMax', pointCounterMax) - Mapping_engine.setConfig(mappingConfigIRVE) - convertDataForIRVE(sourceFilePathGeoJson, mappingConfigIRVE, pointCounterMax, boundingBoxCoordinates) + console.log(' - using mapping engine') + console.log(' - pointCounterMax', pointCounterMax) + Mapping_engine.setConfig(mappingConfigIRVE) + convertDataForIRVE(sourceFilePathGeoJson, mappingConfigIRVE, pointCounterMax, boundingBoxCoordinates) } else { - mappingConfigIRVE = mappingConfigIRVE_simple - convertDataForIRVE(sourceFilePathGeoJson, mappingConfigIRVE, pointCounterMax, boundingBoxCoordinates) + let mappingConfigIRVE = mappingConfigIRVE_simple + convertDataForIRVE(sourceFilePathGeoJson, mappingConfigIRVE, pointCounterMax, boundingBoxCoordinates) } diff --git a/mapping_geojson_to_osm_tags/coverage/clover.xml b/mapping_geojson_to_osm_tags/coverage/clover.xml index d6179860..4754567a 100644 --- a/mapping_geojson_to_osm_tags/coverage/clover.xml +++ b/mapping_geojson_to_osm_tags/coverage/clover.xml @@ -1,7 +1,7 @@ - - - + + + @@ -43,7 +43,7 @@ - + @@ -250,6 +250,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mapping_geojson_to_osm_tags/coverage/coverage-final.json b/mapping_geojson_to_osm_tags/coverage/coverage-final.json index d817ef28..e81aebbf 100644 --- a/mapping_geojson_to_osm_tags/coverage/coverage-final.json +++ b/mapping_geojson_to_osm_tags/coverage/coverage-final.json @@ -1,3 +1,4 @@ {"/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/data_other/testing/mappings_to_test.ts": {"path":"/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/data_other/testing/mappings_to_test.ts","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":67}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":0}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":3}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":50}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":3}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":52}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":34}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":54}},"8":{"start":{"line":9,"column":0},"end":{"line":9,"column":34}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":37}},"10":{"start":{"line":11,"column":0},"end":{"line":11,"column":6}},"11":{"start":{"line":12,"column":0},"end":{"line":12,"column":11}},"12":{"start":{"line":13,"column":0},"end":{"line":13,"column":24}},"13":{"start":{"line":14,"column":0},"end":{"line":14,"column":49}},"14":{"start":{"line":15,"column":0},"end":{"line":15,"column":33}},"15":{"start":{"line":16,"column":0},"end":{"line":16,"column":43}},"16":{"start":{"line":17,"column":0},"end":{"line":17,"column":117}},"17":{"start":{"line":18,"column":0},"end":{"line":18,"column":18}},"18":{"start":{"line":19,"column":0},"end":{"line":19,"column":13}},"19":{"start":{"line":20,"column":0},"end":{"line":20,"column":9}},"20":{"start":{"line":21,"column":0},"end":{"line":21,"column":5}},"21":{"start":{"line":22,"column":0},"end":{"line":22,"column":1}},"22":{"start":{"line":23,"column":0},"end":{"line":23,"column":49}},"23":{"start":{"line":24,"column":0},"end":{"line":24,"column":34}},"24":{"start":{"line":25,"column":0},"end":{"line":25,"column":54}},"25":{"start":{"line":26,"column":0},"end":{"line":26,"column":34}},"26":{"start":{"line":27,"column":0},"end":{"line":27,"column":37}},"27":{"start":{"line":28,"column":0},"end":{"line":28,"column":6}},"28":{"start":{"line":29,"column":0},"end":{"line":29,"column":11}},"29":{"start":{"line":30,"column":0},"end":{"line":30,"column":24}},"30":{"start":{"line":31,"column":0},"end":{"line":31,"column":35}},"31":{"start":{"line":32,"column":0},"end":{"line":32,"column":9}},"32":{"start":{"line":33,"column":0},"end":{"line":33,"column":5}},"33":{"start":{"line":34,"column":0},"end":{"line":34,"column":1}}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":1,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":1,"20":1,"21":1,"22":1,"23":1,"24":1,"25":1,"26":1,"27":1,"28":1,"29":1,"30":1,"31":1,"32":1,"33":1},"branchMap":{},"b":{},"fnMap":{},"f":{}} ,"/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/mappings/engine.ts": {"path":"/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/mappings/engine.ts","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":0}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":31}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":0}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":25}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":20}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":19}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":27}},"8":{"start":{"line":9,"column":0},"end":{"line":9,"column":25}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":14}},"10":{"start":{"line":11,"column":0},"end":{"line":11,"column":20}},"11":{"start":{"line":12,"column":0},"end":{"line":12,"column":18}},"12":{"start":{"line":13,"column":0},"end":{"line":13,"column":22}},"13":{"start":{"line":14,"column":0},"end":{"line":14,"column":1}},"14":{"start":{"line":15,"column":0},"end":{"line":15,"column":0}},"15":{"start":{"line":16,"column":0},"end":{"line":16,"column":22}},"16":{"start":{"line":17,"column":0},"end":{"line":17,"column":28}},"17":{"start":{"line":18,"column":0},"end":{"line":18,"column":0}},"18":{"start":{"line":19,"column":0},"end":{"line":19,"column":32}},"19":{"start":{"line":20,"column":0},"end":{"line":20,"column":37}},"20":{"start":{"line":21,"column":0},"end":{"line":21,"column":5}},"21":{"start":{"line":22,"column":0},"end":{"line":22,"column":0}},"22":{"start":{"line":23,"column":0},"end":{"line":23,"column":30}},"23":{"start":{"line":24,"column":0},"end":{"line":24,"column":43}},"24":{"start":{"line":25,"column":0},"end":{"line":25,"column":5}},"25":{"start":{"line":26,"column":0},"end":{"line":26,"column":0}},"26":{"start":{"line":27,"column":0},"end":{"line":27,"column":42}},"27":{"start":{"line":28,"column":0},"end":{"line":28,"column":0}},"28":{"start":{"line":29,"column":0},"end":{"line":29,"column":43}},"29":{"start":{"line":30,"column":0},"end":{"line":30,"column":95}},"30":{"start":{"line":31,"column":0},"end":{"line":31,"column":61}},"31":{"start":{"line":32,"column":0},"end":{"line":32,"column":69}},"32":{"start":{"line":33,"column":0},"end":{"line":33,"column":0}},"33":{"start":{"line":34,"column":0},"end":{"line":34,"column":50}},"34":{"start":{"line":35,"column":0},"end":{"line":35,"column":0}},"35":{"start":{"line":36,"column":0},"end":{"line":36,"column":39}},"36":{"start":{"line":37,"column":0},"end":{"line":37,"column":0}},"37":{"start":{"line":38,"column":0},"end":{"line":38,"column":10}},"38":{"start":{"line":39,"column":0},"end":{"line":39,"column":0}},"39":{"start":{"line":40,"column":0},"end":{"line":40,"column":36}},"40":{"start":{"line":41,"column":0},"end":{"line":41,"column":5}},"41":{"start":{"line":42,"column":0},"end":{"line":42,"column":0}},"42":{"start":{"line":43,"column":0},"end":{"line":43,"column":7}},"43":{"start":{"line":44,"column":0},"end":{"line":44,"column":66}},"44":{"start":{"line":45,"column":0},"end":{"line":45,"column":26}},"45":{"start":{"line":46,"column":0},"end":{"line":46,"column":25}},"46":{"start":{"line":47,"column":0},"end":{"line":47,"column":7}},"47":{"start":{"line":48,"column":0},"end":{"line":48,"column":41}},"48":{"start":{"line":49,"column":0},"end":{"line":49,"column":0}},"49":{"start":{"line":50,"column":0},"end":{"line":50,"column":61}},"50":{"start":{"line":51,"column":0},"end":{"line":51,"column":5}},"51":{"start":{"line":52,"column":0},"end":{"line":52,"column":0}},"52":{"start":{"line":53,"column":0},"end":{"line":53,"column":51}},"53":{"start":{"line":54,"column":0},"end":{"line":54,"column":53}},"54":{"start":{"line":55,"column":0},"end":{"line":55,"column":0}},"55":{"start":{"line":56,"column":0},"end":{"line":56,"column":7}},"56":{"start":{"line":57,"column":0},"end":{"line":57,"column":32}},"57":{"start":{"line":58,"column":0},"end":{"line":58,"column":25}},"58":{"start":{"line":59,"column":0},"end":{"line":59,"column":28}},"59":{"start":{"line":60,"column":0},"end":{"line":60,"column":7}},"60":{"start":{"line":61,"column":0},"end":{"line":61,"column":77}},"61":{"start":{"line":62,"column":0},"end":{"line":62,"column":41}},"62":{"start":{"line":63,"column":0},"end":{"line":63,"column":15}},"63":{"start":{"line":64,"column":0},"end":{"line":64,"column":27}},"64":{"start":{"line":65,"column":0},"end":{"line":65,"column":5}},"65":{"start":{"line":66,"column":0},"end":{"line":66,"column":0}},"66":{"start":{"line":67,"column":0},"end":{"line":67,"column":66}},"67":{"start":{"line":68,"column":0},"end":{"line":68,"column":48}},"68":{"start":{"line":69,"column":0},"end":{"line":69,"column":44}},"69":{"start":{"line":70,"column":0},"end":{"line":70,"column":18}},"70":{"start":{"line":71,"column":0},"end":{"line":71,"column":30}},"71":{"start":{"line":72,"column":0},"end":{"line":72,"column":8}},"72":{"start":{"line":73,"column":0},"end":{"line":73,"column":0}},"73":{"start":{"line":74,"column":0},"end":{"line":74,"column":80}},"74":{"start":{"line":75,"column":0},"end":{"line":75,"column":61}},"75":{"start":{"line":76,"column":0},"end":{"line":76,"column":72}},"76":{"start":{"line":77,"column":0},"end":{"line":77,"column":10}},"77":{"start":{"line":78,"column":0},"end":{"line":78,"column":27}},"78":{"start":{"line":79,"column":0},"end":{"line":79,"column":5}},"79":{"start":{"line":80,"column":0},"end":{"line":80,"column":0}},"80":{"start":{"line":81,"column":0},"end":{"line":81,"column":7}},"81":{"start":{"line":82,"column":0},"end":{"line":82,"column":82}},"82":{"start":{"line":83,"column":0},"end":{"line":83,"column":7}},"83":{"start":{"line":84,"column":0},"end":{"line":84,"column":43}},"84":{"start":{"line":85,"column":0},"end":{"line":85,"column":35}},"85":{"start":{"line":86,"column":0},"end":{"line":86,"column":161}},"86":{"start":{"line":87,"column":0},"end":{"line":87,"column":0}},"87":{"start":{"line":88,"column":0},"end":{"line":88,"column":9}},"88":{"start":{"line":89,"column":0},"end":{"line":89,"column":0}},"89":{"start":{"line":90,"column":0},"end":{"line":90,"column":68}},"90":{"start":{"line":91,"column":0},"end":{"line":91,"column":64}},"91":{"start":{"line":92,"column":0},"end":{"line":92,"column":63}},"92":{"start":{"line":93,"column":0},"end":{"line":93,"column":55}},"93":{"start":{"line":94,"column":0},"end":{"line":94,"column":77}},"94":{"start":{"line":95,"column":0},"end":{"line":95,"column":0}},"95":{"start":{"line":96,"column":0},"end":{"line":96,"column":104}},"96":{"start":{"line":97,"column":0},"end":{"line":97,"column":134}},"97":{"start":{"line":98,"column":0},"end":{"line":98,"column":0}},"98":{"start":{"line":99,"column":0},"end":{"line":99,"column":90}},"99":{"start":{"line":100,"column":0},"end":{"line":100,"column":0}},"100":{"start":{"line":101,"column":0},"end":{"line":101,"column":15}},"101":{"start":{"line":102,"column":0},"end":{"line":102,"column":45}},"102":{"start":{"line":103,"column":0},"end":{"line":103,"column":51}},"103":{"start":{"line":104,"column":0},"end":{"line":104,"column":42}},"104":{"start":{"line":105,"column":0},"end":{"line":105,"column":50}},"105":{"start":{"line":106,"column":0},"end":{"line":106,"column":0}},"106":{"start":{"line":107,"column":0},"end":{"line":107,"column":58}},"107":{"start":{"line":108,"column":0},"end":{"line":108,"column":60}},"108":{"start":{"line":109,"column":0},"end":{"line":109,"column":0}},"109":{"start":{"line":110,"column":0},"end":{"line":110,"column":88}},"110":{"start":{"line":111,"column":0},"end":{"line":111,"column":0}},"111":{"start":{"line":112,"column":0},"end":{"line":112,"column":10}},"112":{"start":{"line":113,"column":0},"end":{"line":113,"column":0}},"113":{"start":{"line":114,"column":0},"end":{"line":114,"column":44}},"114":{"start":{"line":115,"column":0},"end":{"line":115,"column":0}},"115":{"start":{"line":116,"column":0},"end":{"line":116,"column":40}},"116":{"start":{"line":117,"column":0},"end":{"line":117,"column":24}},"117":{"start":{"line":118,"column":0},"end":{"line":118,"column":5}},"118":{"start":{"line":119,"column":0},"end":{"line":119,"column":0}},"119":{"start":{"line":120,"column":0},"end":{"line":120,"column":77}},"120":{"start":{"line":121,"column":0},"end":{"line":121,"column":49}},"121":{"start":{"line":122,"column":0},"end":{"line":122,"column":56}},"122":{"start":{"line":123,"column":0},"end":{"line":123,"column":143}},"123":{"start":{"line":124,"column":0},"end":{"line":124,"column":35}},"124":{"start":{"line":125,"column":0},"end":{"line":125,"column":0}},"125":{"start":{"line":126,"column":0},"end":{"line":126,"column":81}},"126":{"start":{"line":127,"column":0},"end":{"line":127,"column":62}},"127":{"start":{"line":128,"column":0},"end":{"line":128,"column":56}},"128":{"start":{"line":129,"column":0},"end":{"line":129,"column":52}},"129":{"start":{"line":130,"column":0},"end":{"line":130,"column":78}},"130":{"start":{"line":131,"column":0},"end":{"line":131,"column":99}},"131":{"start":{"line":132,"column":0},"end":{"line":132,"column":0}},"132":{"start":{"line":133,"column":0},"end":{"line":133,"column":64}},"133":{"start":{"line":134,"column":0},"end":{"line":134,"column":0}},"134":{"start":{"line":135,"column":0},"end":{"line":135,"column":32}},"135":{"start":{"line":136,"column":0},"end":{"line":136,"column":43}},"136":{"start":{"line":137,"column":0},"end":{"line":137,"column":54}},"137":{"start":{"line":138,"column":0},"end":{"line":138,"column":83}},"138":{"start":{"line":139,"column":0},"end":{"line":139,"column":68}},"139":{"start":{"line":140,"column":0},"end":{"line":140,"column":89}},"140":{"start":{"line":141,"column":0},"end":{"line":141,"column":0}},"141":{"start":{"line":142,"column":0},"end":{"line":142,"column":24}},"142":{"start":{"line":143,"column":0},"end":{"line":143,"column":62}},"143":{"start":{"line":144,"column":0},"end":{"line":144,"column":17}},"144":{"start":{"line":145,"column":0},"end":{"line":145,"column":61}},"145":{"start":{"line":146,"column":0},"end":{"line":146,"column":37}},"146":{"start":{"line":147,"column":0},"end":{"line":147,"column":85}},"147":{"start":{"line":148,"column":0},"end":{"line":148,"column":17}},"148":{"start":{"line":149,"column":0},"end":{"line":149,"column":47}},"149":{"start":{"line":150,"column":0},"end":{"line":150,"column":31}},"150":{"start":{"line":151,"column":0},"end":{"line":151,"column":60}},"151":{"start":{"line":152,"column":0},"end":{"line":152,"column":0}},"152":{"start":{"line":153,"column":0},"end":{"line":153,"column":49}},"153":{"start":{"line":154,"column":0},"end":{"line":154,"column":55}},"154":{"start":{"line":155,"column":0},"end":{"line":155,"column":17}},"155":{"start":{"line":156,"column":0},"end":{"line":156,"column":0}},"156":{"start":{"line":157,"column":0},"end":{"line":157,"column":19}},"157":{"start":{"line":158,"column":0},"end":{"line":158,"column":54}},"158":{"start":{"line":159,"column":0},"end":{"line":159,"column":106}},"159":{"start":{"line":160,"column":0},"end":{"line":160,"column":19}},"160":{"start":{"line":161,"column":0},"end":{"line":161,"column":54}},"161":{"start":{"line":162,"column":0},"end":{"line":162,"column":93}},"162":{"start":{"line":163,"column":0},"end":{"line":163,"column":96}},"163":{"start":{"line":164,"column":0},"end":{"line":164,"column":46}},"164":{"start":{"line":165,"column":0},"end":{"line":165,"column":90}},"165":{"start":{"line":166,"column":0},"end":{"line":166,"column":0}},"166":{"start":{"line":167,"column":0},"end":{"line":167,"column":61}},"167":{"start":{"line":168,"column":0},"end":{"line":168,"column":77}},"168":{"start":{"line":169,"column":0},"end":{"line":169,"column":81}},"169":{"start":{"line":170,"column":0},"end":{"line":170,"column":25}},"170":{"start":{"line":171,"column":0},"end":{"line":171,"column":62}},"171":{"start":{"line":172,"column":0},"end":{"line":172,"column":128}},"172":{"start":{"line":173,"column":0},"end":{"line":173,"column":140}},"173":{"start":{"line":174,"column":0},"end":{"line":174,"column":60}},"174":{"start":{"line":175,"column":0},"end":{"line":175,"column":94}},"175":{"start":{"line":176,"column":0},"end":{"line":176,"column":80}},"176":{"start":{"line":177,"column":0},"end":{"line":177,"column":29}},"177":{"start":{"line":178,"column":0},"end":{"line":178,"column":25}},"178":{"start":{"line":179,"column":0},"end":{"line":179,"column":61}},"179":{"start":{"line":180,"column":0},"end":{"line":180,"column":93}},"180":{"start":{"line":181,"column":0},"end":{"line":181,"column":79}},"181":{"start":{"line":182,"column":0},"end":{"line":182,"column":29}},"182":{"start":{"line":183,"column":0},"end":{"line":183,"column":25}},"183":{"start":{"line":184,"column":0},"end":{"line":184,"column":68}},"184":{"start":{"line":185,"column":0},"end":{"line":185,"column":62}},"185":{"start":{"line":186,"column":0},"end":{"line":186,"column":60}},"186":{"start":{"line":187,"column":0},"end":{"line":187,"column":109}},"187":{"start":{"line":188,"column":0},"end":{"line":188,"column":25}},"188":{"start":{"line":189,"column":0},"end":{"line":189,"column":50}},"189":{"start":{"line":190,"column":0},"end":{"line":190,"column":70}},"190":{"start":{"line":191,"column":0},"end":{"line":191,"column":79}},"191":{"start":{"line":192,"column":0},"end":{"line":192,"column":25}},"192":{"start":{"line":193,"column":0},"end":{"line":193,"column":21}},"193":{"start":{"line":194,"column":0},"end":{"line":194,"column":17}},"194":{"start":{"line":195,"column":0},"end":{"line":195,"column":0}},"195":{"start":{"line":196,"column":0},"end":{"line":196,"column":63}},"196":{"start":{"line":197,"column":0},"end":{"line":197,"column":58}},"197":{"start":{"line":198,"column":0},"end":{"line":198,"column":17}},"198":{"start":{"line":199,"column":0},"end":{"line":199,"column":13}},"199":{"start":{"line":200,"column":0},"end":{"line":200,"column":9}},"200":{"start":{"line":201,"column":0},"end":{"line":201,"column":5}},"201":{"start":{"line":202,"column":0},"end":{"line":202,"column":0}},"202":{"start":{"line":203,"column":0},"end":{"line":203,"column":1}}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":1,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":1,"20":1,"21":1,"22":1,"23":1,"24":1,"25":1,"26":1,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":1,"42":1,"43":1,"44":1,"45":1,"46":1,"47":1,"48":0,"49":0,"50":0,"51":1,"52":1,"53":1,"54":1,"55":1,"56":1,"57":1,"58":1,"59":1,"60":1,"61":0,"62":0,"63":0,"64":0,"65":1,"66":1,"67":1,"68":1,"69":1,"70":1,"71":1,"72":1,"73":1,"74":0,"75":0,"76":0,"77":0,"78":0,"79":1,"80":1,"81":1,"82":1,"83":1,"84":1,"85":0,"86":0,"87":0,"88":1,"89":1,"90":1,"91":1,"92":1,"93":1,"94":1,"95":1,"96":1,"97":1,"98":1,"99":1,"100":1,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":1,"119":1,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":0,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":0,"185":0,"186":0,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":0,"194":0,"195":0,"196":0,"197":0,"198":0,"199":0,"200":0,"201":1,"202":1},"branchMap":{"0":{"type":"branch","line":16,"loc":{"start":{"line":16,"column":15},"end":{"line":203,"column":1}},"locations":[{"start":{"line":16,"column":15},"end":{"line":203,"column":1}}]},"1":{"type":"branch","line":19,"loc":{"start":{"line":19,"column":4},"end":{"line":21,"column":5}},"locations":[{"start":{"line":19,"column":4},"end":{"line":21,"column":5}}]},"2":{"type":"branch","line":23,"loc":{"start":{"line":23,"column":4},"end":{"line":25,"column":5}},"locations":[{"start":{"line":23,"column":4},"end":{"line":25,"column":5}}]},"3":{"type":"branch","line":84,"loc":{"start":{"line":84,"column":4},"end":{"line":118,"column":5}},"locations":[{"start":{"line":84,"column":4},"end":{"line":118,"column":5}}]},"4":{"type":"branch","line":85,"loc":{"start":{"line":85,"column":34},"end":{"line":88,"column":9}},"locations":[{"start":{"line":85,"column":34},"end":{"line":88,"column":9}}]},"5":{"type":"branch","line":101,"loc":{"start":{"line":101,"column":8},"end":{"line":118,"column":5}},"locations":[{"start":{"line":101,"column":8},"end":{"line":118,"column":5}}]}},"b":{"0":[1],"1":[1],"2":[1],"3":[1],"4":[0],"5":[0]},"fnMap":{"0":{"name":"","decl":{"start":{"line":16,"column":15},"end":{"line":203,"column":1}},"loc":{"start":{"line":16,"column":15},"end":{"line":203,"column":1}},"line":16},"1":{"name":"_default","decl":{"start":{"line":19,"column":4},"end":{"line":21,"column":5}},"loc":{"start":{"line":19,"column":4},"end":{"line":21,"column":5}},"line":19},"2":{"name":"setConfig","decl":{"start":{"line":23,"column":4},"end":{"line":25,"column":5}},"loc":{"start":{"line":23,"column":4},"end":{"line":25,"column":5}},"line":23},"3":{"name":"mapFeaturePoint","decl":{"start":{"line":27,"column":4},"end":{"line":41,"column":5}},"loc":{"start":{"line":27,"column":4},"end":{"line":41,"column":5}},"line":27},"4":{"name":"isBooleanKey","decl":{"start":{"line":48,"column":4},"end":{"line":51,"column":5}},"loc":{"start":{"line":48,"column":4},"end":{"line":51,"column":5}},"line":48},"5":{"name":"filterFeaturesByOffset","decl":{"start":{"line":61,"column":4},"end":{"line":65,"column":5}},"loc":{"start":{"line":61,"column":4},"end":{"line":65,"column":5}},"line":61},"6":{"name":"filterFeaturesByPropertyRegex","decl":{"start":{"line":74,"column":4},"end":{"line":79,"column":5}},"loc":{"start":{"line":74,"column":4},"end":{"line":79,"column":5}},"line":74},"7":{"name":"mapElementFromConf","decl":{"start":{"line":84,"column":4},"end":{"line":118,"column":5}},"loc":{"start":{"line":84,"column":4},"end":{"line":118,"column":5}},"line":84},"8":{"name":"convertProperty","decl":{"start":{"line":120,"column":4},"end":{"line":201,"column":5}},"loc":{"start":{"line":120,"column":4},"end":{"line":201,"column":5}},"line":120}},"f":{"0":1,"1":1,"2":1,"3":0,"4":0,"5":0,"6":0,"7":1,"8":0}} +,"/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/mappings/utils.js": {"path":"/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/mappings/utils.js","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":79}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":90}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":33}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":65}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":28}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":9}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":5}},"8":{"start":{"line":9,"column":0},"end":{"line":9,"column":61}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":2}},"10":{"start":{"line":11,"column":0},"end":{"line":11,"column":62}},"11":{"start":{"line":12,"column":0},"end":{"line":12,"column":25}},"12":{"start":{"line":13,"column":0},"end":{"line":13,"column":19}},"13":{"start":{"line":14,"column":0},"end":{"line":14,"column":15}},"14":{"start":{"line":15,"column":0},"end":{"line":15,"column":29}},"15":{"start":{"line":16,"column":0},"end":{"line":16,"column":3}},"16":{"start":{"line":17,"column":0},"end":{"line":17,"column":68}},"17":{"start":{"line":18,"column":0},"end":{"line":18,"column":14}},"18":{"start":{"line":19,"column":0},"end":{"line":19,"column":3}},"19":{"start":{"line":20,"column":0},"end":{"line":20,"column":21}},"20":{"start":{"line":21,"column":0},"end":{"line":21,"column":18}},"21":{"start":{"line":22,"column":0},"end":{"line":22,"column":51}},"22":{"start":{"line":23,"column":0},"end":{"line":23,"column":33}},"23":{"start":{"line":24,"column":0},"end":{"line":24,"column":5}},"24":{"start":{"line":25,"column":0},"end":{"line":25,"column":22}},"25":{"start":{"line":26,"column":0},"end":{"line":26,"column":15}},"26":{"start":{"line":27,"column":0},"end":{"line":27,"column":5}},"27":{"start":{"line":28,"column":0},"end":{"line":28,"column":72}},"28":{"start":{"line":29,"column":0},"end":{"line":29,"column":1}},"29":{"start":{"line":30,"column":0},"end":{"line":30,"column":25}},"30":{"start":{"line":31,"column":0},"end":{"line":31,"column":20}},"31":{"start":{"line":32,"column":0},"end":{"line":32,"column":19}},"32":{"start":{"line":33,"column":0},"end":{"line":33,"column":27}},"33":{"start":{"line":34,"column":0},"end":{"line":34,"column":25}},"34":{"start":{"line":35,"column":0},"end":{"line":35,"column":14}},"35":{"start":{"line":36,"column":0},"end":{"line":36,"column":20}},"36":{"start":{"line":37,"column":0},"end":{"line":37,"column":18}},"37":{"start":{"line":38,"column":0},"end":{"line":38,"column":22}},"38":{"start":{"line":39,"column":0},"end":{"line":39,"column":2}},"39":{"start":{"line":40,"column":0},"end":{"line":40,"column":3}},"40":{"start":{"line":41,"column":0},"end":{"line":41,"column":2}},"41":{"start":{"line":42,"column":0},"end":{"line":42,"column":22}},"42":{"start":{"line":43,"column":0},"end":{"line":43,"column":21}},"43":{"start":{"line":44,"column":0},"end":{"line":44,"column":3}},"44":{"start":{"line":45,"column":0},"end":{"line":45,"column":37}},"45":{"start":{"line":46,"column":0},"end":{"line":46,"column":58}},"46":{"start":{"line":47,"column":0},"end":{"line":47,"column":1}},"47":{"start":{"line":48,"column":0},"end":{"line":48,"column":3}},"48":{"start":{"line":49,"column":0},"end":{"line":49,"column":53}},"49":{"start":{"line":50,"column":0},"end":{"line":50,"column":18}},"50":{"start":{"line":51,"column":0},"end":{"line":51,"column":21}},"51":{"start":{"line":52,"column":0},"end":{"line":52,"column":3}},"52":{"start":{"line":53,"column":0},"end":{"line":53,"column":43}},"53":{"start":{"line":54,"column":0},"end":{"line":54,"column":38}},"54":{"start":{"line":55,"column":0},"end":{"line":55,"column":121}},"55":{"start":{"line":56,"column":0},"end":{"line":56,"column":18}},"56":{"start":{"line":57,"column":0},"end":{"line":57,"column":57}},"57":{"start":{"line":58,"column":0},"end":{"line":58,"column":9}},"58":{"start":{"line":59,"column":0},"end":{"line":59,"column":14}},"59":{"start":{"line":60,"column":0},"end":{"line":60,"column":76}},"60":{"start":{"line":61,"column":0},"end":{"line":61,"column":9}},"61":{"start":{"line":62,"column":0},"end":{"line":62,"column":7}},"62":{"start":{"line":63,"column":0},"end":{"line":63,"column":1}},"63":{"start":{"line":64,"column":0},"end":{"line":64,"column":19}},"64":{"start":{"line":65,"column":0},"end":{"line":65,"column":23}},"65":{"start":{"line":66,"column":0},"end":{"line":66,"column":31}},"66":{"start":{"line":67,"column":0},"end":{"line":67,"column":24}},"67":{"start":{"line":68,"column":0},"end":{"line":68,"column":2}}},"s":{"0":1,"1":1,"2":3,"3":0,"4":0,"5":0,"6":0,"7":0,"8":3,"9":3,"10":1,"11":1,"12":1,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":3,"20":3,"21":3,"22":8,"23":8,"24":3,"25":0,"26":0,"27":3,"28":3,"29":1,"30":1,"31":1,"32":1,"33":1,"34":1,"35":1,"36":1,"37":1,"38":1,"39":1,"40":1,"41":1,"42":1,"43":1,"44":0,"45":0,"46":0,"47":1,"48":1,"49":1,"50":1,"51":1,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":1,"64":1,"65":1,"66":1,"67":1},"branchMap":{"0":{"type":"branch","line":2,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":47}},"locations":[{"start":{"line":2,"column":21},"end":{"line":2,"column":47}}]},"1":{"type":"branch","line":2,"loc":{"start":{"line":2,"column":52},"end":{"line":10,"column":2}},"locations":[{"start":{"line":2,"column":52},"end":{"line":10,"column":2}}]},"2":{"type":"branch","line":3,"loc":{"start":{"line":3,"column":40},"end":{"line":8,"column":5}},"locations":[{"start":{"line":3,"column":40},"end":{"line":8,"column":5}}]},"3":{"type":"branch","line":20,"loc":{"start":{"line":20,"column":0},"end":{"line":29,"column":1}},"locations":[{"start":{"line":20,"column":0},"end":{"line":29,"column":1}}]},"4":{"type":"branch","line":22,"loc":{"start":{"line":22,"column":50},"end":{"line":24,"column":5}},"locations":[{"start":{"line":22,"column":50},"end":{"line":24,"column":5}}]},"5":{"type":"branch","line":25,"loc":{"start":{"line":25,"column":21},"end":{"line":27,"column":5}},"locations":[{"start":{"line":25,"column":21},"end":{"line":27,"column":5}}]}},"b":{"0":[0],"1":[3],"2":[0],"3":[3],"4":[8],"5":[0]},"fnMap":{"0":{"name":"Object..__spreadArray","decl":{"start":{"line":2,"column":52},"end":{"line":10,"column":2}},"loc":{"start":{"line":2,"column":52},"end":{"line":10,"column":2}},"line":2},"1":{"name":"debugLog","decl":{"start":{"line":20,"column":0},"end":{"line":29,"column":1}},"loc":{"start":{"line":20,"column":0},"end":{"line":29,"column":1}},"line":20},"2":{"name":"isBooleanKey","decl":{"start":{"line":45,"column":0},"end":{"line":47,"column":1}},"loc":{"start":{"line":45,"column":0},"end":{"line":47,"column":1}},"line":45},"3":{"name":"writeFile","decl":{"start":{"line":53,"column":0},"end":{"line":63,"column":1}},"loc":{"start":{"line":53,"column":0},"end":{"line":63,"column":1}},"line":53}},"f":{"0":3,"1":3,"2":0,"3":0}} } diff --git a/mapping_geojson_to_osm_tags/coverage/lcov-report/data_other/testing/index.html b/mapping_geojson_to_osm_tags/coverage/lcov-report/data_other/testing/index.html index 2860094d..c00572b0 100644 --- a/mapping_geojson_to_osm_tags/coverage/lcov-report/data_other/testing/index.html +++ b/mapping_geojson_to_osm_tags/coverage/lcov-report/data_other/testing/index.html @@ -101,7 +101,7 @@ + + + + + + \ No newline at end of file diff --git a/mapping_geojson_to_osm_tags/coverage/lcov.info b/mapping_geojson_to_osm_tags/coverage/lcov.info index 6fc274f1..75d70ecf 100644 --- a/mapping_geojson_to_osm_tags/coverage/lcov.info +++ b/mapping_geojson_to_osm_tags/coverage/lcov.info @@ -277,3 +277,94 @@ BRDA:101,5,0,0 BRF:6 BRH:4 end_of_record +TN: +SF:mappings/utils.js +FN:2,Object..__spreadArray +FN:20,debugLog +FN:45,isBooleanKey +FN:53,writeFile +FNF:4 +FNH:2 +FNDA:3,Object..__spreadArray +FNDA:3,debugLog +FNDA:0,isBooleanKey +FNDA:0,writeFile +DA:1,1 +DA:2,1 +DA:3,3 +DA:4,0 +DA:5,0 +DA:6,0 +DA:7,0 +DA:8,0 +DA:9,3 +DA:10,3 +DA:11,1 +DA:12,1 +DA:13,1 +DA:14,1 +DA:15,1 +DA:16,1 +DA:17,1 +DA:18,1 +DA:19,1 +DA:20,3 +DA:21,3 +DA:22,3 +DA:23,8 +DA:24,8 +DA:25,3 +DA:26,0 +DA:27,0 +DA:28,3 +DA:29,3 +DA:30,1 +DA:31,1 +DA:32,1 +DA:33,1 +DA:34,1 +DA:35,1 +DA:36,1 +DA:37,1 +DA:38,1 +DA:39,1 +DA:40,1 +DA:41,1 +DA:42,1 +DA:43,1 +DA:44,1 +DA:45,0 +DA:46,0 +DA:47,0 +DA:48,1 +DA:49,1 +DA:50,1 +DA:51,1 +DA:52,1 +DA:53,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:57,0 +DA:58,0 +DA:59,0 +DA:60,0 +DA:61,0 +DA:62,0 +DA:63,0 +DA:64,1 +DA:65,1 +DA:66,1 +DA:67,1 +DA:68,1 +LF:68 +LH:47 +BRDA:2,0,0,0 +BRDA:2,1,0,3 +BRDA:3,2,0,0 +BRDA:20,3,0,3 +BRDA:22,4,0,8 +BRDA:25,5,0,0 +BRF:6 +BRH:3 +end_of_record diff --git a/mapping_geojson_to_osm_tags/mappings/converters/configIRVE.js b/mapping_geojson_to_osm_tags/mappings/converters/configIRVE.js new file mode 100644 index 00000000..3a72d400 --- /dev/null +++ b/mapping_geojson_to_osm_tags/mappings/converters/configIRVE.js @@ -0,0 +1,96 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var MappingIRVE = { + config_name: "IRVE config", + config_author: "tykayn ", + default_properties_of_point: { + 'amenity': 'charging_station' + }, + tags: { + // ******* nombres + nbre_pdc: 'capacity', + // ******* textes + amenity: 'amenity', + capacity: 'capacity', + nom_amenageur: 'operator', + siren_amenageur: 'owner:ref:FR:SIREN', + nom_operateur: 'operator', + telephone_operateur: 'phone', + contact_operateur: 'email', + id_station_itinerance: 'ref:EU:EVSE', + id_station_local: 'ref', + gratuit: 'fee', + paiement_acte: 'authentication:none', + reservation: 'reservation', + observations: 'note', + nom_station: 'name', + nom_enseigne: 'network', + // ******* dates + date_mise_en_service: 'start_date', + date_maj: 'source:date', + // TODO gestion des types dont on doit convertir la valeur + // ******** champs booléens + cable_t2_attache: { + key_converted: 'socket:type2_cable', + // cable_t2_attache + truthy_value: '1' + }, + prise_type_ef: 'socket:typee', + prise_type_2: 'socket:type2', + prise_type_combo_ccs: 'socket:type2_combo', + prise_type_chademo: 'socket:chademo', + // ******** champs plus complexes + horaires: 'opening_hours', + // accessibilite_pmr: 'wheelchair', + // paiement_cb: 'payment:credit_cards', + accessibilite_pmr: { + key_converted: "wheelchair", + conditional_values: { + "Accessibilité inconnue": { + // value_converted: "", + ignore_this_data: true, // ne pas ajouter de tag si la valeur est égale à Accessibilité inconnue. + // transform_function : (original_value) => original_value.toLowerCase(), + }, + "Accessible mais non réservé PMR": { + value_converted: "yes" + }, + "Réservé PMR": { + value_converted: "yes" + }, + "Non accessible": { + value_converted: "no" + }, + // "Mo-Fr 08:30-12:00,Mo-Fr 14:00-19:00,Sat 09:00-18:30": { + // value_converted: "Mo-Fr 08:30-12:00,Mo-Fr 14:00-19:00,Sat 09:00-18:30" + // }, + // "24/7": { + // value_converted: "" + // } + // choix: + // Sa:09:00-19:00 + // 24/7 + // Mo-Fr 08:00-12:00,Mo-Fr 14:00-19:00,Sat 09:00-18:00 + // Mo-Fr 08:00-19:00,Sat 09:00-18:00 + // Sa:08:00-19:00 + // 24/7 + // Mo-Fr 08:30-12:00,Mo-Fr 14:00-19:00,Sat 09:00-18:30 + // Mo-Fr 09:00-16:00 + // Mo-Fr 08:00-12:00,Mo-Fr 14:00-18:00,Th 08:00-18:00 + } + }, + station_deux_roues: { + key_converted: null, + conditional_values: { + // ajout de trois tags si la valeur est yes + "yes": { + tags_to_add: [ + { bicycle: "yes" }, + { scooter: "yes" }, + { motorcar: "no" }, + ] + } + } + } + }, +}; +exports.default = MappingIRVE; diff --git a/mapping_geojson_to_osm_tags/mappings/converters/configIRVE.ts b/mapping_geojson_to_osm_tags/mappings/converters/configIRVE.ts index 9481cf52..ebd07f1b 100644 --- a/mapping_geojson_to_osm_tags/mappings/converters/configIRVE.ts +++ b/mapping_geojson_to_osm_tags/mappings/converters/configIRVE.ts @@ -3,7 +3,7 @@ * détail dans le tableau * https://wiki.openstreetmap.org/wiki/France/data.gouv.fr/Bornes_de_Recharge_pour_V%C3%A9hicules_%C3%89lectriques */ -import MappingConfigType, {FeaturePropertyMappingConfigType} from "../mapping-config.type"; +import MappingConfigType from "../mapping-config.type"; const MappingIRVE: MappingConfigType = { config_name: "IRVE config", @@ -11,7 +11,7 @@ const MappingIRVE: MappingConfigType = { default_properties_of_point: { 'amenity': 'charging_station' }, - tags : { + tags: { // ******* nombres nbre_pdc: 'capacity', diff --git a/mapping_geojson_to_osm_tags/mappings/converters/mappingConfigIRVE_simple.js b/mapping_geojson_to_osm_tags/mappings/converters/mappingConfigIRVE_simple.js new file mode 100644 index 00000000..ef040352 --- /dev/null +++ b/mapping_geojson_to_osm_tags/mappings/converters/mappingConfigIRVE_simple.js @@ -0,0 +1,38 @@ +"use strict"; +/** + * plan de conversion des clés du jeu de données vers les tags OSM + * détail dans le tableau + * https://wiki.openstreetmap.org/wiki/France/data.gouv.fr/Bornes_de_Recharge_pour_V%C3%A9hicules_%C3%89lectriques + */ +Object.defineProperty(exports, "__esModule", { value: true }); +var mappingIRVE = { + // ******* nombres + nbre_pdc: 'capacity', + amenity: 'amenity', + capacity: 'capacity', + nom_amenageur: 'operator', + siren_amenageur: 'owner:ref:FR:SIREN', + nom_operateur: 'operator', + telephone_operateur: 'phone', + // ici, on souhaite convertir la clé contact_operateur=bidule en email=bidule + contact_operateur: 'email', + id_station_itinerance: 'ref:EU:EVSE', + id_station_local: 'ref', + gratuit: 'fee', + paiement_acte: 'authentication:none', + reservation: 'reservation', + observations: 'note', + nom_station: 'name', + nom_enseigne: 'network', + // ******* dates + date_mise_en_service: 'start_date', + date_maj: 'source:date', + // ******** champs booléens + prise_type_ef: 'socket:typee', + prise_type_2: 'socket:type2', + prise_type_combo_ccs: 'socket:type2_combo', + prise_type_chademo: 'socket:chademo', + // ******** champs plus complexes + horaires: 'opening_hours', // déjà au bon format +}; +exports.default = mappingIRVE; diff --git a/mapping_geojson_to_osm_tags/mappings/engine.js b/mapping_geojson_to_osm_tags/mappings/engine.js new file mode 100644 index 00000000..bcee8340 --- /dev/null +++ b/mapping_geojson_to_osm_tags/mappings/engine.js @@ -0,0 +1,183 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var utils_1 = require("./utils"); +var debugLog = utils_1.default.debugLog; +var listOfBooleanKeys = [ + "prise_type_ef", + "prise_type_2", + "prise_type_combo_ccs", + "prise_type_chademo", + "gratuit", + "paiement_acte", + "paiement_cb", + "cable_t2_attache" +]; +var default_1 = /** @class */ (function () { + function default_1(mappingConfig) { + this.mapping_config = {}; + this.truthyValues = ['true', 'True', 'TRUE', '1', 1]; + this.falsyValues = ['false', 'False', 'FALSE', '0', 0]; + this.setConfig(mappingConfig); + } + default_1.prototype.setConfig = function (mappingConfig) { + this.mapping_config = mappingConfig; + }; + default_1.prototype.mapFeaturePoint = function (featurePointGeoJson) { + var geoJSONConvertedPoint = {}; + geoJSONConvertedPoint.properties = __assign({}, this.mapping_config.default_properties_of_point); + geoJSONConvertedPoint.type = featurePointGeoJson.type; + geoJSONConvertedPoint.geometry = featurePointGeoJson.geometry; + var props = featurePointGeoJson.properties; + props.forEach(function (key, value) { + }); + return geoJSONConvertedPoint; + }; + /** + * TODO convert to mapping config property to transform_truthy + * @param pointKeyName + * @returns {boolean} + */ + default_1.prototype.isBooleanKey = function (pointKeyName) { + return listOfBooleanKeys.indexOf(pointKeyName) !== -1; + }; + /** + * reduce number of features + * @param offsetCount + * @param listOfFeatures + */ + default_1.prototype.filterFeaturesByOffset = function (offsetCount, listOfFeatures) { + var filteredList = listOfFeatures; + // TODO + return filteredList; + }; + // filterFeaturesByPropertyRegex(bboxConfig, listOfFeatures) { + // console.log('bboxConfig', bboxConfig) + // let filteredList = listOfFeatures + // // TODO + // return filteredList + // } + default_1.prototype.filterFeaturesByPropertyRegex = function (propertyName, criteriaRegex, listOfFeatures) { + var filteredList = listOfFeatures.filter(function (feature) { + return criteriaRegex.test(feature === null || feature === void 0 ? void 0 : feature.properties[propertyName]); + }); + return filteredList; + }; + /** + * retuns the converted element from mapping config if present, null otherwise + */ + default_1.prototype.mapElementFromConf = function (featurePoint) { + var _this = this; + if (!this.mapping_config) { + throw new Error('no config was loaded in the mapping engine. use setConfig(my_mapping_config) on this instance of mapping engine before using this.'); + } + console.log('mapping_config tags', this.mapping_config.tags); + debugLog('config_name', this.mapping_config.config_name); + var mappingKeys = Object.keys(this.mapping_config.tags); + // let mappingKeys = (this.mapping_config.tags) + var featurePointPropertiesKeys = Object.keys(featurePoint.properties); + debugLog('============= keys mappingKeys:', this.mapping_config.tags.length, mappingKeys.length); + debugLog('============= keys featurePointPropertiesKeys :', featurePoint.properties.length, featurePointPropertiesKeys.length); + var newProperties = Object.create(this.mapping_config.default_properties_of_point); + return; + // reinit properties of current point + var basePoint = Object.create(featurePoint); + basePoint.type = featurePoint.type; + basePoint.geometry = featurePoint.geometry; + // apply new properties if found in mapping config + featurePointPropertiesKeys.forEach(function (pointKeyName) { + _this.convertProperty(pointKeyName, mappingKeys, featurePoint, newProperties); + }); + basePoint.properties = newProperties; + debugLog('basePoint', basePoint); + return basePoint; + }; + default_1.prototype.convertProperty = function (pointKeyName, mappingKeys, featurePoint, newProperties) { + console.log('pointKeyName', pointKeyName); + if (!mappingKeys.indexOf(pointKeyName) !== -1) { + debugLog('found element', pointKeyName, '=>', this.mapping_config[pointKeyName], 'value : ', featurePoint.properties[pointKeyName]); + var convertedValue = ''; + var valueConvertedFromMapping = featurePoint.properties[pointKeyName]; + var typeofValue = typeof valueConvertedFromMapping; + var isStringValue = typeofValue === 'string'; + debugLog('- pointKeyName', pointKeyName); + debugLog('- valueConvertedFromMapping', valueConvertedFromMapping); + // debugLog('typeof featurePoint.properties[pointKeyName] === \'string\'', typeofValue) + var isConfigMappingObject = typeofValue === 'string'; + if (isStringValue) { + debugLog('-- string value'); + if (this.isBooleanKey(pointKeyName)) { + var lowerValue = (valueConvertedFromMapping + '').toLowerCase(); + debugLog('isBooleanKey: lowerValue', lowerValue); + convertedValue = this.truthyValues.indexOf(lowerValue) ? 'yes' : 'no'; + } + else { + convertedValue = valueConvertedFromMapping; + } + debugLog('-- convertedValue', convertedValue); + if (convertedValue) { + newProperties[this.mapping_config[pointKeyName]] = convertedValue; + } + } + else if (isConfigMappingObject) { + var newKey = ''; + var configObject = valueConvertedFromMapping; + if (configObject.key_converted) { + newKey = configObject.key_converted; + } + /** + * gestion des valeurs conditionnelles + * nous pouvons renseigner une string ou un objet décrivant les transformations à réaliser + */ + if (configObject.conditional_values) { + var keysConditionnalValues = Object.keys(configObject.conditional_values); + var isFoundValue = keysConditionnalValues.indexOf(valueConvertedFromMapping); + if (isFoundValue !== -1) { + var conditionnalConfig = keysConditionnalValues[isFoundValue]; + if (conditionnalConfig.tags_to_add) { + // on peut définir un ensemble de tags à rajouter + newProperties.push.apply(newProperties, conditionnalConfig.tags_to_add); + } + if (conditionnalConfig.truthy_value) { + // convertir la valeur, si elle est truthy, la transformer en ce que donne la propriété truthy_value + // exemple: le jeu de données dit que la colonne cable_t2_attache vaut "True", mais on veut le convertir en "1". + // on met donc truthy_value: '1' + if (this.truthyValues.indexOf(valueConvertedFromMapping) !== -1) { + convertedValue = conditionnalConfig.truthy_value; + } + } + if (conditionnalConfig.falsy_value) { + if (this.falsyValues.indexOf(valueConvertedFromMapping) !== -1) { + convertedValue = conditionnalConfig.falsy_value; + } + } + if (conditionnalConfig.transform_function) { + // une transformation de la valeur + // apply transformation to value + convertedValue = conditionnalConfig.transform_function(valueConvertedFromMapping); + } + // use the value converted + else if (conditionnalConfig.value_converted) { + convertedValue = conditionnalConfig.value_converted; + } + } + } + if (newKey && !configObject.ignore_this_data) { + newProperties[newKey] = convertedValue; + } + } + } + }; + return default_1; +}()); +exports.default = default_1; diff --git a/mapping_geojson_to_osm_tags/mappings/mapping-config.type.js b/mapping_geojson_to_osm_tags/mappings/mapping-config.type.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/mapping_geojson_to_osm_tags/mappings/mapping-config.type.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/mapping_geojson_to_osm_tags/mappings/utils.js b/mapping_geojson_to_osm_tags/mappings/utils.js new file mode 100644 index 00000000..022eefd2 --- /dev/null +++ b/mapping_geojson_to_osm_tags/mappings/utils.js @@ -0,0 +1,68 @@ +"use strict"; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var fs_1 = require("fs"); +var show_debug = 0; +show_debug = 1; +var output_folder = 'output'; +/** + * wrapper de log qui se montre uniquemnt si show_debug a été activé + * @param args + */ +function debugLog() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (!show_debug) { + return; + } + console.log.apply(console, __spreadArray(['debug: '], args, false)); +} +var listOfBooleanKeys = [ + "prise_type_ef", + "prise_type_2", + "prise_type_combo_ccs", + "prise_type_chademo", + "gratuit", + "paiement_acte", + "paiement_cb", + "cable_t2_attache" +]; +/** + * + * @param pointKeyName + * @returns {boolean} + */ +function isBooleanKey(pointKeyName) { + return listOfBooleanKeys.indexOf(pointKeyName) !== -1; +} +/** + * crée un fichier dans le dossier par défaut, output + * @param fileName + * @param fileContent + */ +function writeFile(fileName, fileContent) { + debugLog('write file ', fileName); + return fs_1.default.writeFile("./".concat(output_folder, "/").concat(fileName), fileContent, 'utf8', function (err) { + if (err) { + debugLog("Error writing file: ".concat(err)); + } + else { + debugLog("File ".concat(fileName, " is written successfully!")); + } + }); +} +exports.default = { + debugLog: debugLog, + isBooleanKey: isBooleanKey, + writeFile: writeFile +}; diff --git a/mapping_geojson_to_osm_tags/mappings/utils.ts b/mapping_geojson_to_osm_tags/mappings/utils.ts index 384c2f1a..68d89da0 100644 --- a/mapping_geojson_to_osm_tags/mappings/utils.ts +++ b/mapping_geojson_to_osm_tags/mappings/utils.ts @@ -1,4 +1,4 @@ -import fs from 'node:fs' +import fs from 'fs' let show_debug = 0 show_debug = 1 diff --git a/mapping_geojson_to_osm_tags/package.json b/mapping_geojson_to_osm_tags/package.json index efd5efb0..e438aec3 100644 --- a/mapping_geojson_to_osm_tags/package.json +++ b/mapping_geojson_to_osm_tags/package.json @@ -11,6 +11,7 @@ }, "scripts": { "start": "ts-node convert_to_osm_tags.ts --engine", + "simple": "ts-node convert_to_osm_tags.ts", "filter": "node convert_to_osm_tags.ts --department=76 --engine=true", "test": "jest --coverage --watch" }, @@ -24,7 +25,7 @@ "@babel/preset-typescript": "^7.22.5", "@jest/globals": "^29.6.2", "@types/minimist": "^1.2.2", - "@types/node": "^20.4.5", + "@types/node": "^20.4.7", "babel-jest": "^29.6.2", "jest": "^29.6.2", "loglevel": "^1.8.1", diff --git a/mapping_geojson_to_osm_tags/pnpm-lock.yaml b/mapping_geojson_to_osm_tags/pnpm-lock.yaml index 525f0a5f..ba50a089 100644 --- a/mapping_geojson_to_osm_tags/pnpm-lock.yaml +++ b/mapping_geojson_to_osm_tags/pnpm-lock.yaml @@ -29,14 +29,14 @@ devDependencies: specifier: ^1.2.2 version: 1.2.2 '@types/node': - specifier: ^20.4.5 - version: 20.4.5 + specifier: ^20.4.7 + version: 20.4.7 babel-jest: specifier: ^29.6.2 version: 29.6.2(@babel/core@7.22.9) jest: specifier: ^29.6.2 - version: 29.6.2(@types/node@20.4.5)(ts-node@10.9.1) + version: 29.6.2(@types/node@20.4.7)(ts-node@10.9.1) loglevel: specifier: ^1.8.1 version: 1.8.1 @@ -48,7 +48,7 @@ devDependencies: version: 29.1.1(@babel/core@7.22.9)(babel-jest@29.6.2)(jest@29.6.2)(typescript@5.1.6) ts-node: specifier: ^10.9.1 - version: 10.9.1(@types/node@20.4.5)(typescript@5.1.6) + version: 10.9.1(@types/node@20.4.7)(typescript@5.1.6) tslib: specifier: ^2.6.1 version: 2.6.1 @@ -179,7 +179,7 @@ packages: '@babel/helper-plugin-utils': 7.22.5 debug: 4.3.4 lodash.debounce: 4.0.8 - resolve: 1.22.2 + resolve: 1.22.4 transitivePeerDependencies: - supports-color dev: true @@ -1323,7 +1323,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 chalk: 4.1.2 jest-message-util: 29.6.2 jest-util: 29.6.2 @@ -1344,14 +1344,14 @@ packages: '@jest/test-result': 29.6.2 '@jest/transform': 29.6.2 '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.8.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.5.0 - jest-config: 29.6.2(@types/node@20.4.5)(ts-node@10.9.1) + jest-config: 29.6.2(@types/node@20.4.7)(ts-node@10.9.1) jest-haste-map: 29.6.2 jest-message-util: 29.6.2 jest-regex-util: 29.4.3 @@ -1379,7 +1379,7 @@ packages: dependencies: '@jest/fake-timers': 29.6.2 '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 jest-mock: 29.6.2 dev: true @@ -1406,7 +1406,7 @@ packages: dependencies: '@jest/types': 29.6.1 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 20.4.5 + '@types/node': 20.4.7 jest-message-util: 29.6.2 jest-mock: 29.6.2 jest-util: 29.6.2 @@ -1439,7 +1439,7 @@ packages: '@jest/transform': 29.6.2 '@jest/types': 29.6.1 '@jridgewell/trace-mapping': 0.3.18 - '@types/node': 20.4.5 + '@types/node': 20.4.7 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -1527,7 +1527,7 @@ packages: '@jest/schemas': 29.6.0 '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 '@types/yargs': 17.0.24 chalk: 4.1.2 dev: true @@ -1642,7 +1642,7 @@ packages: /@types/graceful-fs@4.1.6: resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==} dependencies: - '@types/node': 20.4.5 + '@types/node': 20.4.7 dev: true /@types/istanbul-lib-coverage@2.0.4: @@ -1665,8 +1665,8 @@ packages: resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} dev: true - /@types/node@20.4.5: - resolution: {integrity: sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg==} + /@types/node@20.4.7: + resolution: {integrity: sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g==} dev: true /@types/stack-utils@2.0.1: @@ -1883,8 +1883,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001518 - electron-to-chromium: 1.4.480 + caniuse-lite: 1.0.30001519 + electron-to-chromium: 1.4.485 node-releases: 2.0.13 update-browserslist-db: 1.0.11(browserslist@4.21.10) dev: true @@ -1921,8 +1921,8 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite@1.0.30001518: - resolution: {integrity: sha512-rup09/e3I0BKjncL+FesTayKtPrdwKhUufQFd3riFw1hHg8JmIFoInYfB102cFcY/pPgGmdyl/iy+jgiDi2vdA==} + /caniuse-lite@1.0.30001519: + resolution: {integrity: sha512-0QHgqR+Jv4bxHMp8kZ1Kn8CH55OikjKJ6JmKkZYP1F3D7w+lnFXF70nG5eNfsZS89jadi5Ywy5UCSKLAglIRkg==} dev: true /chalk@2.4.2: @@ -2094,8 +2094,8 @@ packages: engines: {node: '>=0.3.1'} dev: true - /electron-to-chromium@1.4.480: - resolution: {integrity: sha512-IXTgg+bITkQv/FLP9FjX6f9KFCs5hQWeh5uNSKxB9mqYj/JXhHDbu+ekS43LVvbkL3eW6/oZy4+r9Om6lan1Uw==} + /electron-to-chromium@1.4.485: + resolution: {integrity: sha512-1ndQ5IBNEnFirPwvyud69GHL+31FkE09gH/CJ6m3KCbkx3i0EVOrjwz4UNxRmN9H8OVHbC6vMRZGN1yCvjSs9w==} dev: true /emittery@0.13.1: @@ -2164,7 +2164,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/expect-utils': 29.6.2 - '@types/node': 20.4.5 + '@types/node': 20.4.7 jest-get-type: 29.4.3 jest-matcher-utils: 29.6.2 jest-message-util: 29.6.2 @@ -2325,8 +2325,8 @@ packages: binary-extensions: 2.2.0 dev: true - /is-core-module@2.12.1: - resolution: {integrity: sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==} + /is-core-module@2.13.0: + resolution: {integrity: sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==} dependencies: has: 1.0.3 dev: true @@ -2429,7 +2429,7 @@ packages: '@jest/expect': 29.6.2 '@jest/test-result': 29.6.2 '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.1 @@ -2450,7 +2450,7 @@ packages: - supports-color dev: true - /jest-cli@29.6.2(@types/node@20.4.5)(ts-node@10.9.1): + /jest-cli@29.6.2(@types/node@20.4.7)(ts-node@10.9.1): resolution: {integrity: sha512-TT6O247v6dCEX2UGHGyflMpxhnrL0DNqP2fRTKYm3nJJpCTfXX3GCMQPGFjXDoj0i5/Blp3jriKXFgdfmbYB6Q==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -2467,7 +2467,7 @@ packages: exit: 0.1.2 graceful-fs: 4.2.11 import-local: 3.1.0 - jest-config: 29.6.2(@types/node@20.4.5)(ts-node@10.9.1) + jest-config: 29.6.2(@types/node@20.4.7)(ts-node@10.9.1) jest-util: 29.6.2 jest-validate: 29.6.2 prompts: 2.4.2 @@ -2479,7 +2479,7 @@ packages: - ts-node dev: true - /jest-config@29.6.2(@types/node@20.4.5)(ts-node@10.9.1): + /jest-config@29.6.2(@types/node@20.4.7)(ts-node@10.9.1): resolution: {integrity: sha512-VxwFOC8gkiJbuodG9CPtMRjBUNZEHxwfQXmIudSTzFWxaci3Qub1ddTRbFNQlD/zUeaifLndh/eDccFX4wCMQw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: @@ -2494,7 +2494,7 @@ packages: '@babel/core': 7.22.9 '@jest/test-sequencer': 29.6.2 '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 babel-jest: 29.6.2(@babel/core@7.22.9) chalk: 4.1.2 ci-info: 3.8.0 @@ -2514,7 +2514,7 @@ packages: pretty-format: 29.6.2 slash: 3.0.0 strip-json-comments: 3.1.1 - ts-node: 10.9.1(@types/node@20.4.5)(typescript@5.1.6) + ts-node: 10.9.1(@types/node@20.4.7)(typescript@5.1.6) transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -2555,7 +2555,7 @@ packages: '@jest/environment': 29.6.2 '@jest/fake-timers': 29.6.2 '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 jest-mock: 29.6.2 jest-util: 29.6.2 dev: true @@ -2571,7 +2571,7 @@ packages: dependencies: '@jest/types': 29.6.1 '@types/graceful-fs': 4.1.6 - '@types/node': 20.4.5 + '@types/node': 20.4.7 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -2622,7 +2622,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 jest-util: 29.6.2 dev: true @@ -2663,7 +2663,7 @@ packages: jest-pnp-resolver: 1.2.3(jest-resolve@29.6.2) jest-util: 29.6.2 jest-validate: 29.6.2 - resolve: 1.22.2 + resolve: 1.22.4 resolve.exports: 2.0.2 slash: 3.0.0 dev: true @@ -2677,7 +2677,7 @@ packages: '@jest/test-result': 29.6.2 '@jest/transform': 29.6.2 '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -2708,7 +2708,7 @@ packages: '@jest/test-result': 29.6.2 '@jest/transform': 29.6.2 '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 chalk: 4.1.2 cjs-module-lexer: 1.2.3 collect-v8-coverage: 1.0.2 @@ -2760,7 +2760,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 chalk: 4.1.2 ci-info: 3.8.0 graceful-fs: 4.2.11 @@ -2785,7 +2785,7 @@ packages: dependencies: '@jest/test-result': 29.6.2 '@jest/types': 29.6.1 - '@types/node': 20.4.5 + '@types/node': 20.4.7 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -2797,13 +2797,13 @@ packages: resolution: {integrity: sha512-l3ccBOabTdkng8I/ORCkADz4eSMKejTYv1vB/Z83UiubqhC1oQ5Li6dWCyqOIvSifGjUBxuvxvlm6KGK2DtuAQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@types/node': 20.4.5 + '@types/node': 20.4.7 jest-util: 29.6.2 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true - /jest@29.6.2(@types/node@20.4.5)(ts-node@10.9.1): + /jest@29.6.2(@types/node@20.4.7)(ts-node@10.9.1): resolution: {integrity: sha512-8eQg2mqFbaP7CwfsTpCxQ+sHzw1WuNWL5UUvjnWP4hx2riGz9fPSzYOaU5q8/GqWn1TfgZIVTqYJygbGbWAANg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -2816,7 +2816,7 @@ packages: '@jest/core': 29.6.2(ts-node@10.9.1) '@jest/types': 29.6.1 import-local: 3.1.0 - jest-cli: 29.6.2(@types/node@20.4.5)(ts-node@10.9.1) + jest-cli: 29.6.2(@types/node@20.4.7)(ts-node@10.9.1) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -3197,11 +3197,11 @@ packages: engines: {node: '>=10'} dev: true - /resolve@1.22.2: - resolution: {integrity: sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==} + /resolve@1.22.4: + resolution: {integrity: sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==} hasBin: true dependencies: - is-core-module: 2.12.1 + is-core-module: 2.13.0 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 dev: true @@ -3406,7 +3406,7 @@ packages: babel-jest: 29.6.2(@babel/core@7.22.9) bs-logger: 0.2.6 fast-json-stable-stringify: 2.1.0 - jest: 29.6.2(@types/node@20.4.5)(ts-node@10.9.1) + jest: 29.6.2(@types/node@20.4.7)(ts-node@10.9.1) jest-util: 29.6.2 json5: 2.2.3 lodash.memoize: 4.1.2 @@ -3416,7 +3416,7 @@ packages: yargs-parser: 21.1.1 dev: true - /ts-node@10.9.1(@types/node@20.4.5)(typescript@5.1.6): + /ts-node@10.9.1(@types/node@20.4.7)(typescript@5.1.6): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -3435,7 +3435,7 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.4.5 + '@types/node': 20.4.7 acorn: 8.10.0 acorn-walk: 8.2.0 arg: 4.1.3 diff --git a/mapping_geojson_to_osm_tags/tests/main.test.js b/mapping_geojson_to_osm_tags/tests/main.test.js index e042bc0b..8d66ebc4 100644 --- a/mapping_geojson_to_osm_tags/tests/main.test.js +++ b/mapping_geojson_to_osm_tags/tests/main.test.js @@ -13,8 +13,7 @@ describe('mapping properties with rich mapping engine', () => { let Mapping_engine = new mapping_engine(mappingRemoveAll) - let mapped_point = { properties: []} - mapped_point = Mapping_engine.mapElementFromConf(testingGeoJson.features[0]) + let mapped_point = Mapping_engine.mapElementFromConf(testingGeoJson.features[0]) expect(mapped_point.properties).toBe([]) }) diff --git a/mapping_geojson_to_osm_tags/tsconfig.js b/mapping_geojson_to_osm_tags/tsconfig.js index a7f5da39..7121460e 100644 --- a/mapping_geojson_to_osm_tags/tsconfig.js +++ b/mapping_geojson_to_osm_tags/tsconfig.js @@ -1,3 +1,30 @@ module.exports= { - noImplicitAny: false, + "compilerOptions": { + "outDir": "build/dist", + "module": "esnext", + "target": "es2020", + "lib": ["esnext", "dom"], + "sourceMap": true, + "allowJs": true, + "jsx": "react", + "moduleResolution": "node", + "rootDir": "src", + "forceConsistentCasingInFileNames": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noImplicitAny": false, //here + "strictNullChecks": true, + "suppressImplicitAnyIndexErrors": true, + "noUnusedLocals": true, + "noUnusedParameters": true + }, + "exclude": [ + "node_modules", + "build", + "scripts", + "acceptance-tests", + "webpack", + "jest", + "src/setupTests.ts" + ] } \ No newline at end of file