more types

This commit is contained in:
Tykayn 2023-08-05 10:57:07 +02:00 committed by tykayn
parent 0a1b3ee772
commit 8562758358
22 changed files with 1288 additions and 222 deletions

View File

@ -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);
}

View File

@ -1,14 +1,14 @@
/** /**
* convertisseur de données de bornes de recharge électrique à partir de données Chargemap et open data Etalab * convertisseur de données de bornes de recharge électrique à partir de données Chargemap et open data Etalab
*/ */
import fs from 'node' import * as fs from 'fs'
import * as minimist from 'minimist'
import mappingConfigIRVE from './mappings/converters/configIRVE' import mappingConfigIRVE from './mappings/converters/configIRVE'
import mappingConfigIRVE_simple from './mappings/converters/mappingConfigIRVE_simple' import mappingConfigIRVE_simple from './mappings/converters/mappingConfigIRVE_simple'
import mapping_engine from './mappings/engine' import mapping_engine from './mappings/engine'
import custom_utils from './mappings/utils' import MappingConfigType, {BoundingBoxCoordinatesType, FeatureCollection} from "./mappings/mapping-config.type";
import MappingConfigType, {BoundingBoxCoordinatesType} from "./mappings/mapping-config.type"; import utils from './mappings/utils'
import utils from './mappings/utils.ts' const minimist = require('minimist')
const debugLog = utils.debugLog; const debugLog = utils.debugLog;
@ -17,7 +17,7 @@ use_mappping_engine = true
let Mapping_engine = new mapping_engine(mappingConfigIRVE) 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' let sourceFilePathGeoJson = './etalab_data/small.json'
@ -58,19 +58,19 @@ if (enable_filter_on_department) {
} else if (filterOnBoundingBox) { } 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 // limitConversionToFirstPoint = true
if (limitConversionToFirstPoint) { if (limitConversionToFirstPoint) {
pointCounterMax = 1 pointCounterMax = 1
} }
let defaultPropertiesOfPoint = { let defaultPropertiesOfPoint :any= {
'amenity': 'charging_station' 'amenity': 'charging_station'
} }
let converted_geo_json = { let converted_geo_json :any = {
type: 'FeatureCollection', type: 'FeatureCollection',
features: [] features: []
} }
@ -82,7 +82,7 @@ let converted_geo_json = {
* @param pointCounterMax * @param pointCounterMax
* @param boundingBoxCoordinates * @param boundingBoxCoordinates
*/ */
function convertDataForIRVE (sourceFilePath, mapping: MappingConfigType, pointCounterMax, boundingBoxCoordinates) { function convertDataForIRVE(sourceFilePath: string, mapping: MappingConfigType, pointCounterMax: number, boundingBoxCoordinates: any) {
debugLog('convertDataFromChargemap from ', sourceFilePath) debugLog('convertDataFromChargemap from ', sourceFilePath)
fs.readFile(sourceFilePath, 'utf8', function (err, data) { fs.readFile(sourceFilePath, 'utf8', function (err, data) {
@ -90,7 +90,7 @@ function convertDataForIRVE (sourceFilePath, mapping: MappingConfigType, pointCo
if (err) { if (err) {
return debugLog(err) return debugLog(err)
} }
let data_transformed = JSON.parse(data) let data_transformed: FeatureCollection = JSON.parse(data)
// debug('data keys ', Object.keys(dataTransformed)) // debug('data keys ', Object.keys(dataTransformed))
debugLog('debug: properties of point 0', data_transformed.features[0]) debugLog('debug: properties of point 0', data_transformed.features[0])
@ -99,11 +99,11 @@ function convertDataForIRVE (sourceFilePath, mapping: MappingConfigType, pointCo
debugLog('data found, features:', data_transformed.features.length) debugLog('data found, features:', data_transformed.features.length)
// find interesting list of points to use // find interesting list of points to use
let list_of_points = data_transformed.features let list_of_points : any = data_transformed.features
// for each point from the data source, convert with the mapping // for each point from the data source, convert with the mapping
console.log('listOfPoints.length', list_of_points.length) console.log('listOfPoints.length', list_of_points.length)
list_of_points.forEach(feature_point => { list_of_points.forEach((feature_point: any) => {
let regex_filter_test_result = true let regex_filter_test_result = true
@ -114,7 +114,8 @@ function convertDataForIRVE (sourceFilePath, mapping: MappingConfigType, pointCo
|| ||
filterZipCodeAdresse.test(feature_point.properties.adresse_station) filterZipCodeAdresse.test(feature_point.properties.adresse_station)
) )
} else if (filterOnBoundingBox) { }
else if (filterOnBoundingBox) {
debugLog('filtre sur les coordonnées activé') debugLog('filtre sur les coordonnées activé')
let x = feature_point.properties.coordonneesXY[0] let x = feature_point.properties.coordonneesXY[0]
@ -144,7 +145,7 @@ function convertDataForIRVE (sourceFilePath, mapping: MappingConfigType, pointCo
debugLog('featurePoint', feature_point) debugLog('featurePoint', feature_point)
let mapped_point = {} let mapped_point: any = {}
if (use_mappping_engine) { if (use_mappping_engine) {
mapped_point = Mapping_engine.mapElementFromConf(feature_point) mapped_point = Mapping_engine.mapElementFromConf(feature_point)
@ -177,13 +178,13 @@ function convertDataForIRVE (sourceFilePath, mapping: MappingConfigType, pointCo
/** /**
* retuns the converted element from mapping config if present, null otherwise * retuns the converted element from mapping config if present, null otherwise
*/ */
function mapElementFromConfSimple (featurePoint, mappingConfig) { function mapElementFromConfSimple(featurePoint: any, mappingConfig: MappingConfigType) {
let mappingKeys = Object.keys(mappingConfig) let mappingKeys = Object.keys(mappingConfig)
let featurePointPropertiesKeys = Object.keys(featurePoint.properties) 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 // reinit properties of current point
let basePoint = Object.create(featurePoint) let basePoint = Object.create(featurePoint)
@ -192,11 +193,11 @@ function mapElementFromConfSimple (featurePoint, mappingConfig) {
basePoint.properties = newProperties basePoint.properties = newProperties
// apply new properties if found in mapping config // apply new properties if found in mapping config
featurePointPropertiesKeys.forEach(pointKeyName => { featurePointPropertiesKeys.forEach((pointKeyName: string) => {
if (mappingKeys.indexOf(pointKeyName) !== -1) { if (mappingKeys.indexOf(pointKeyName) !== -1) {
debugLog('found element', pointKeyName, '=>', mappingConfig[pointKeyName], 'value : ', featurePoint.properties[pointKeyName]) debugLog('found element', pointKeyName, '=>', mappingConfig[pointKeyName], 'value : ', featurePoint.properties[pointKeyName])
let convertedValue = '' let convertedValue: any = ''
if (utils.isBooleanKey(pointKeyName)) { if (utils.isBooleanKey(pointKeyName)) {
let copyOfValue: any = '' + featurePoint.properties[pointKeyName] let copyOfValue: any = '' + featurePoint.properties[pointKeyName]
@ -226,7 +227,7 @@ if (use_mappping_engine) {
} else { } else {
mappingConfigIRVE = mappingConfigIRVE_simple let mappingConfigIRVE = mappingConfigIRVE_simple
convertDataForIRVE(sourceFilePathGeoJson, mappingConfigIRVE, pointCounterMax, boundingBoxCoordinates) convertDataForIRVE(sourceFilePathGeoJson, mappingConfigIRVE, pointCounterMax, boundingBoxCoordinates)
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1691223461793" clover="3.2.0"> <coverage generated="1691225815979" clover="3.2.0">
<project timestamp="1691223461793" name="All files"> <project timestamp="1691225815979" name="All files">
<metrics statements="237" coveredstatements="110" conditionals="6" coveredconditionals="4" methods="9" coveredmethods="4" elements="252" coveredelements="118" complexity="0" loc="237" ncloc="237" packages="2" files="2" classes="2"/> <metrics statements="305" coveredstatements="157" conditionals="12" coveredconditionals="7" methods="13" coveredmethods="6" elements="330" coveredelements="170" complexity="0" loc="305" ncloc="305" packages="2" files="3" classes="3"/>
<package name="data_other.testing"> <package name="data_other.testing">
<metrics statements="34" coveredstatements="34" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/> <metrics statements="34" coveredstatements="34" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
<file name="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"> <file name="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">
@ -43,7 +43,7 @@
</file> </file>
</package> </package>
<package name="mappings"> <package name="mappings">
<metrics statements="203" coveredstatements="76" conditionals="6" coveredconditionals="4" methods="9" coveredmethods="4"/> <metrics statements="271" coveredstatements="123" conditionals="12" coveredconditionals="7" methods="13" coveredmethods="6"/>
<file name="engine.ts" path="/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/mappings/engine.ts"> <file name="engine.ts" path="/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/mappings/engine.ts">
<metrics statements="203" coveredstatements="76" conditionals="6" coveredconditionals="4" methods="9" coveredmethods="4"/> <metrics statements="203" coveredstatements="76" conditionals="6" coveredconditionals="4" methods="9" coveredmethods="4"/>
<line num="1" count="1" type="stmt"/> <line num="1" count="1" type="stmt"/>
@ -250,6 +250,77 @@
<line num="202" count="1" type="stmt"/> <line num="202" count="1" type="stmt"/>
<line num="203" count="1" type="stmt"/> <line num="203" count="1" type="stmt"/>
</file> </file>
<file name="utils.js" path="/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/mappings/utils.js">
<metrics statements="68" coveredstatements="47" conditionals="6" coveredconditionals="3" methods="4" coveredmethods="2"/>
<line num="1" count="1" type="stmt"/>
<line num="2" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="3" count="3" type="cond" truecount="0" falsecount="1"/>
<line num="4" count="0" type="stmt"/>
<line num="5" count="0" type="stmt"/>
<line num="6" count="0" type="stmt"/>
<line num="7" count="0" type="stmt"/>
<line num="8" count="0" type="stmt"/>
<line num="9" count="3" type="stmt"/>
<line num="10" count="3" type="stmt"/>
<line num="11" count="1" type="stmt"/>
<line num="12" count="1" type="stmt"/>
<line num="13" count="1" type="stmt"/>
<line num="14" count="1" type="stmt"/>
<line num="15" count="1" type="stmt"/>
<line num="16" count="1" type="stmt"/>
<line num="17" count="1" type="stmt"/>
<line num="18" count="1" type="stmt"/>
<line num="19" count="1" type="stmt"/>
<line num="20" count="3" type="cond" truecount="1" falsecount="0"/>
<line num="21" count="3" type="stmt"/>
<line num="22" count="3" type="cond" truecount="1" falsecount="0"/>
<line num="23" count="8" type="stmt"/>
<line num="24" count="8" type="stmt"/>
<line num="25" count="3" type="cond" truecount="0" falsecount="1"/>
<line num="26" count="0" type="stmt"/>
<line num="27" count="0" type="stmt"/>
<line num="28" count="3" type="stmt"/>
<line num="29" count="3" type="stmt"/>
<line num="30" count="1" type="stmt"/>
<line num="31" count="1" type="stmt"/>
<line num="32" count="1" type="stmt"/>
<line num="33" count="1" type="stmt"/>
<line num="34" count="1" type="stmt"/>
<line num="35" count="1" type="stmt"/>
<line num="36" count="1" type="stmt"/>
<line num="37" count="1" type="stmt"/>
<line num="38" count="1" type="stmt"/>
<line num="39" count="1" type="stmt"/>
<line num="40" count="1" type="stmt"/>
<line num="41" count="1" type="stmt"/>
<line num="42" count="1" type="stmt"/>
<line num="43" count="1" type="stmt"/>
<line num="44" count="1" type="stmt"/>
<line num="45" count="0" type="stmt"/>
<line num="46" count="0" type="stmt"/>
<line num="47" count="0" type="stmt"/>
<line num="48" count="1" type="stmt"/>
<line num="49" count="1" type="stmt"/>
<line num="50" count="1" type="stmt"/>
<line num="51" count="1" type="stmt"/>
<line num="52" count="1" type="stmt"/>
<line num="53" count="0" type="stmt"/>
<line num="54" count="0" type="stmt"/>
<line num="55" count="0" type="stmt"/>
<line num="56" count="0" type="stmt"/>
<line num="57" count="0" type="stmt"/>
<line num="58" count="0" type="stmt"/>
<line num="59" count="0" type="stmt"/>
<line num="60" count="0" type="stmt"/>
<line num="61" count="0" type="stmt"/>
<line num="62" count="0" type="stmt"/>
<line num="63" count="0" type="stmt"/>
<line num="64" count="1" type="stmt"/>
<line num="65" count="1" type="stmt"/>
<line num="66" count="1" type="stmt"/>
<line num="67" count="1" type="stmt"/>
<line num="68" count="1" type="stmt"/>
</file>
</package> </package>
</project> </project>
</coverage> </coverage>

File diff suppressed because one or more lines are too long

View File

@ -101,7 +101,7 @@
<div class='footer quiet pad2 space-top1 center small'> <div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2023-08-05T08:17:41.788Z at 2023-08-05T08:56:55.975Z
</div> </div>
<script src="../../prettify.js"></script> <script src="../../prettify.js"></script>
<script> <script>

View File

@ -169,7 +169,7 @@ export const mappingIgnore: MappingConfigType = {
<div class='footer quiet pad2 space-top1 center small'> <div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2023-08-05T08:17:41.788Z at 2023-08-05T08:56:55.975Z
</div> </div>
<script src="../../prettify.js"></script> <script src="../../prettify.js"></script>
<script> <script>

View File

@ -23,30 +23,30 @@
<div class='clearfix'> <div class='clearfix'>
<div class='fl pad1y space-right2'> <div class='fl pad1y space-right2'>
<span class="strong">46.41% </span> <span class="strong">51.47% </span>
<span class="quiet">Statements</span> <span class="quiet">Statements</span>
<span class='fraction'>110/237</span> <span class='fraction'>157/305</span>
</div> </div>
<div class='fl pad1y space-right2'> <div class='fl pad1y space-right2'>
<span class="strong">66.66% </span> <span class="strong">58.33% </span>
<span class="quiet">Branches</span> <span class="quiet">Branches</span>
<span class='fraction'>4/6</span> <span class='fraction'>7/12</span>
</div> </div>
<div class='fl pad1y space-right2'> <div class='fl pad1y space-right2'>
<span class="strong">44.44% </span> <span class="strong">46.15% </span>
<span class="quiet">Functions</span> <span class="quiet">Functions</span>
<span class='fraction'>4/9</span> <span class='fraction'>6/13</span>
</div> </div>
<div class='fl pad1y space-right2'> <div class='fl pad1y space-right2'>
<span class="strong">46.41% </span> <span class="strong">51.47% </span>
<span class="quiet">Lines</span> <span class="quiet">Lines</span>
<span class='fraction'>110/237</span> <span class='fraction'>157/305</span>
</div> </div>
@ -61,7 +61,7 @@
</div> </div>
</template> </template>
</div> </div>
<div class='status-line low'></div> <div class='status-line medium'></div>
<div class="pad1"> <div class="pad1">
<table class="coverage-summary"> <table class="coverage-summary">
<thead> <thead>
@ -95,17 +95,17 @@
<tr> <tr>
<td class="file low" data-value="mappings"><a href="mappings/index.html">mappings</a></td> <td class="file low" data-value="mappings"><a href="mappings/index.html">mappings</a></td>
<td data-value="37.43" class="pic low"> <td data-value="45.38" class="pic low">
<div class="chart"><div class="cover-fill" style="width: 37%"></div><div class="cover-empty" style="width: 63%"></div></div> <div class="chart"><div class="cover-fill" style="width: 45%"></div><div class="cover-empty" style="width: 55%"></div></div>
</td> </td>
<td data-value="37.43" class="pct low">37.43%</td> <td data-value="45.38" class="pct low">45.38%</td>
<td data-value="203" class="abs low">76/203</td> <td data-value="271" class="abs low">123/271</td>
<td data-value="66.66" class="pct medium">66.66%</td> <td data-value="58.33" class="pct medium">58.33%</td>
<td data-value="6" class="abs medium">4/6</td> <td data-value="12" class="abs medium">7/12</td>
<td data-value="44.44" class="pct low">44.44%</td> <td data-value="46.15" class="pct low">46.15%</td>
<td data-value="9" class="abs low">4/9</td> <td data-value="13" class="abs low">6/13</td>
<td data-value="37.43" class="pct low">37.43%</td> <td data-value="45.38" class="pct low">45.38%</td>
<td data-value="203" class="abs low">76/203</td> <td data-value="271" class="abs low">123/271</td>
</tr> </tr>
</tbody> </tbody>
@ -116,7 +116,7 @@
<div class='footer quiet pad2 space-top1 center small'> <div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2023-08-05T08:17:41.788Z at 2023-08-05T08:56:55.975Z
</div> </div>
<script src="prettify.js"></script> <script src="prettify.js"></script>
<script> <script>

View File

@ -676,7 +676,7 @@ export default class {
<div class='footer quiet pad2 space-top1 center small'> <div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2023-08-05T08:17:41.788Z at 2023-08-05T08:56:55.975Z
</div> </div>
<script src="../prettify.js"></script> <script src="../prettify.js"></script>
<script> <script>

View File

@ -23,30 +23,30 @@
<div class='clearfix'> <div class='clearfix'>
<div class='fl pad1y space-right2'> <div class='fl pad1y space-right2'>
<span class="strong">37.43% </span> <span class="strong">45.38% </span>
<span class="quiet">Statements</span> <span class="quiet">Statements</span>
<span class='fraction'>76/203</span> <span class='fraction'>123/271</span>
</div> </div>
<div class='fl pad1y space-right2'> <div class='fl pad1y space-right2'>
<span class="strong">66.66% </span> <span class="strong">58.33% </span>
<span class="quiet">Branches</span> <span class="quiet">Branches</span>
<span class='fraction'>4/6</span> <span class='fraction'>7/12</span>
</div> </div>
<div class='fl pad1y space-right2'> <div class='fl pad1y space-right2'>
<span class="strong">44.44% </span> <span class="strong">46.15% </span>
<span class="quiet">Functions</span> <span class="quiet">Functions</span>
<span class='fraction'>4/9</span> <span class='fraction'>6/13</span>
</div> </div>
<div class='fl pad1y space-right2'> <div class='fl pad1y space-right2'>
<span class="strong">37.43% </span> <span class="strong">45.38% </span>
<span class="quiet">Lines</span> <span class="quiet">Lines</span>
<span class='fraction'>76/203</span> <span class='fraction'>123/271</span>
</div> </div>
@ -93,6 +93,21 @@
<td data-value="203" class="abs low">76/203</td> <td data-value="203" class="abs low">76/203</td>
</tr> </tr>
<tr>
<td class="file medium" data-value="utils.js"><a href="utils.js.html">utils.js</a></td>
<td data-value="69.11" class="pic medium">
<div class="chart"><div class="cover-fill" style="width: 69%"></div><div class="cover-empty" style="width: 31%"></div></div>
</td>
<td data-value="69.11" class="pct medium">69.11%</td>
<td data-value="68" class="abs medium">47/68</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="6" class="abs medium">3/6</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="4" class="abs medium">2/4</td>
<td data-value="69.11" class="pct medium">69.11%</td>
<td data-value="68" class="abs medium">47/68</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -101,7 +116,7 @@
<div class='footer quiet pad2 space-top1 center small'> <div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2023-08-05T08:17:41.788Z at 2023-08-05T08:56:55.975Z
</div> </div>
<script src="../prettify.js"></script> <script src="../prettify.js"></script>
<script> <script>

View File

@ -0,0 +1,289 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for mappings/utils.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="../index.html">All files</a> / <a href="index.html">mappings</a> utils.js</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">69.11% </span>
<span class="quiet">Statements</span>
<span class='fraction'>47/68</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">50% </span>
<span class="quiet">Branches</span>
<span class='fraction'>3/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">50% </span>
<span class="quiet">Functions</span>
<span class='fraction'>2/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">69.11% </span>
<span class="quiet">Lines</span>
<span class='fraction'>47/68</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input oninput="onInput()" type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a>
<a name='L18'></a><a href='#L18'>18</a>
<a name='L19'></a><a href='#L19'>19</a>
<a name='L20'></a><a href='#L20'>20</a>
<a name='L21'></a><a href='#L21'>21</a>
<a name='L22'></a><a href='#L22'>22</a>
<a name='L23'></a><a href='#L23'>23</a>
<a name='L24'></a><a href='#L24'>24</a>
<a name='L25'></a><a href='#L25'>25</a>
<a name='L26'></a><a href='#L26'>26</a>
<a name='L27'></a><a href='#L27'>27</a>
<a name='L28'></a><a href='#L28'>28</a>
<a name='L29'></a><a href='#L29'>29</a>
<a name='L30'></a><a href='#L30'>30</a>
<a name='L31'></a><a href='#L31'>31</a>
<a name='L32'></a><a href='#L32'>32</a>
<a name='L33'></a><a href='#L33'>33</a>
<a name='L34'></a><a href='#L34'>34</a>
<a name='L35'></a><a href='#L35'>35</a>
<a name='L36'></a><a href='#L36'>36</a>
<a name='L37'></a><a href='#L37'>37</a>
<a name='L38'></a><a href='#L38'>38</a>
<a name='L39'></a><a href='#L39'>39</a>
<a name='L40'></a><a href='#L40'>40</a>
<a name='L41'></a><a href='#L41'>41</a>
<a name='L42'></a><a href='#L42'>42</a>
<a name='L43'></a><a href='#L43'>43</a>
<a name='L44'></a><a href='#L44'>44</a>
<a name='L45'></a><a href='#L45'>45</a>
<a name='L46'></a><a href='#L46'>46</a>
<a name='L47'></a><a href='#L47'>47</a>
<a name='L48'></a><a href='#L48'>48</a>
<a name='L49'></a><a href='#L49'>49</a>
<a name='L50'></a><a href='#L50'>50</a>
<a name='L51'></a><a href='#L51'>51</a>
<a name='L52'></a><a href='#L52'>52</a>
<a name='L53'></a><a href='#L53'>53</a>
<a name='L54'></a><a href='#L54'>54</a>
<a name='L55'></a><a href='#L55'>55</a>
<a name='L56'></a><a href='#L56'>56</a>
<a name='L57'></a><a href='#L57'>57</a>
<a name='L58'></a><a href='#L58'>58</a>
<a name='L59'></a><a href='#L59'>59</a>
<a name='L60'></a><a href='#L60'>60</a>
<a name='L61'></a><a href='#L61'>61</a>
<a name='L62'></a><a href='#L62'>62</a>
<a name='L63'></a><a href='#L63'>63</a>
<a name='L64'></a><a href='#L64'>64</a>
<a name='L65'></a><a href='#L65'>65</a>
<a name='L66'></a><a href='#L66'>66</a>
<a name='L67'></a><a href='#L67'>67</a>
<a name='L68'></a><a href='#L68'>68</a>
<a name='L69'></a><a href='#L69'>69</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">"use strict";
var __spreadArray = (<span class="branch-0 cbranch-no" title="branch not covered" >this &amp;&amp; this.__spreadArray)</span> || function (to, from, pack) {
if (pack || arguments.length === 2) <span class="branch-0 cbranch-no" title="branch not covered" >for (var i = 0, l = from.length, ar; i &lt; l; i++) {</span>
<span class="cstat-no" title="statement not covered" > if (ar || !(i in from)) {</span>
<span class="cstat-no" title="statement not covered" > if (!ar) ar = Array.prototype.slice.call(from, 0, i);</span>
<span class="cstat-no" title="statement not covered" > ar[i] = from[i];</span>
<span class="cstat-no" title="statement not covered" > }</span>
<span class="cstat-no" title="statement not covered" > }</span>
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 &lt; arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (!show_debug) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
<span class="cstat-no" title="statement not covered" > return;</span>
<span class="cstat-no" title="statement not covered" > }</span>
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}
*/
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >function isBooleanKey(pointKeyName) {</span></span>
<span class="cstat-no" title="statement not covered" > return listOfBooleanKeys.indexOf(pointKeyName) !== -1;</span>
<span class="cstat-no" title="statement not covered" >}</span>
/**
* crée un fichier dans le dossier par défaut, output
* @param fileName
* @param fileContent
*/
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >function writeFile(fileName, fileContent) {</span></span>
<span class="cstat-no" title="statement not covered" > debugLog('write file ', fileName);</span>
<span class="cstat-no" title="statement not covered" > return fs_1.default.writeFile("./".concat(output_folder, "/").concat(fileName), fileContent, 'utf8', function (err) {</span>
<span class="cstat-no" title="statement not covered" > if (err) {</span>
<span class="cstat-no" title="statement not covered" > debugLog("Error writing file: ".concat(err));</span>
<span class="cstat-no" title="statement not covered" > }</span>
<span class="cstat-no" title="statement not covered" > else {</span>
<span class="cstat-no" title="statement not covered" > debugLog("File ".concat(fileName, " is written successfully!"));</span>
<span class="cstat-no" title="statement not covered" > }</span>
<span class="cstat-no" title="statement not covered" > });</span>
<span class="cstat-no" title="statement not covered" >}</span>
exports.default = {
debugLog: debugLog,
isBooleanKey: isBooleanKey,
writeFile: writeFile
};
&nbsp;</pre></td></tr></table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2023-08-05T08:56:55.975Z
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="../sorter.js"></script>
<script src="../block-navigation.js"></script>
</body>
</html>

View File

@ -277,3 +277,94 @@ BRDA:101,5,0,0
BRF:6 BRF:6
BRH:4 BRH:4
end_of_record end_of_record
TN:
SF:mappings/utils.js
FN:2,Object.<anonymous>.__spreadArray
FN:20,debugLog
FN:45,isBooleanKey
FN:53,writeFile
FNF:4
FNH:2
FNDA:3,Object.<anonymous>.__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

View File

@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MappingIRVE = {
config_name: "IRVE config",
config_author: "tykayn <contact@cipherbliss.com>",
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;

View File

@ -3,7 +3,7 @@
* détail dans le tableau * détail dans le tableau
* https://wiki.openstreetmap.org/wiki/France/data.gouv.fr/Bornes_de_Recharge_pour_V%C3%A9hicules_%C3%89lectriques * 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 = { const MappingIRVE: MappingConfigType = {
config_name: "IRVE config", config_name: "IRVE config",

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -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
};

View File

@ -1,4 +1,4 @@
import fs from 'node:fs' import fs from 'fs'
let show_debug = 0 let show_debug = 0
show_debug = 1 show_debug = 1

View File

@ -11,6 +11,7 @@
}, },
"scripts": { "scripts": {
"start": "ts-node convert_to_osm_tags.ts --engine", "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", "filter": "node convert_to_osm_tags.ts --department=76 --engine=true",
"test": "jest --coverage --watch" "test": "jest --coverage --watch"
}, },
@ -24,7 +25,7 @@
"@babel/preset-typescript": "^7.22.5", "@babel/preset-typescript": "^7.22.5",
"@jest/globals": "^29.6.2", "@jest/globals": "^29.6.2",
"@types/minimist": "^1.2.2", "@types/minimist": "^1.2.2",
"@types/node": "^20.4.5", "@types/node": "^20.4.7",
"babel-jest": "^29.6.2", "babel-jest": "^29.6.2",
"jest": "^29.6.2", "jest": "^29.6.2",
"loglevel": "^1.8.1", "loglevel": "^1.8.1",

View File

@ -29,14 +29,14 @@ devDependencies:
specifier: ^1.2.2 specifier: ^1.2.2
version: 1.2.2 version: 1.2.2
'@types/node': '@types/node':
specifier: ^20.4.5 specifier: ^20.4.7
version: 20.4.5 version: 20.4.7
babel-jest: babel-jest:
specifier: ^29.6.2 specifier: ^29.6.2
version: 29.6.2(@babel/core@7.22.9) version: 29.6.2(@babel/core@7.22.9)
jest: jest:
specifier: ^29.6.2 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: loglevel:
specifier: ^1.8.1 specifier: ^1.8.1
version: 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) version: 29.1.1(@babel/core@7.22.9)(babel-jest@29.6.2)(jest@29.6.2)(typescript@5.1.6)
ts-node: ts-node:
specifier: ^10.9.1 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: tslib:
specifier: ^2.6.1 specifier: ^2.6.1
version: 2.6.1 version: 2.6.1
@ -179,7 +179,7 @@ packages:
'@babel/helper-plugin-utils': 7.22.5 '@babel/helper-plugin-utils': 7.22.5
debug: 4.3.4 debug: 4.3.4
lodash.debounce: 4.0.8 lodash.debounce: 4.0.8
resolve: 1.22.2 resolve: 1.22.4
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true dev: true
@ -1323,7 +1323,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies: dependencies:
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/node': 20.4.5 '@types/node': 20.4.7
chalk: 4.1.2 chalk: 4.1.2
jest-message-util: 29.6.2 jest-message-util: 29.6.2
jest-util: 29.6.2 jest-util: 29.6.2
@ -1344,14 +1344,14 @@ packages:
'@jest/test-result': 29.6.2 '@jest/test-result': 29.6.2
'@jest/transform': 29.6.2 '@jest/transform': 29.6.2
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/node': 20.4.5 '@types/node': 20.4.7
ansi-escapes: 4.3.2 ansi-escapes: 4.3.2
chalk: 4.1.2 chalk: 4.1.2
ci-info: 3.8.0 ci-info: 3.8.0
exit: 0.1.2 exit: 0.1.2
graceful-fs: 4.2.11 graceful-fs: 4.2.11
jest-changed-files: 29.5.0 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-haste-map: 29.6.2
jest-message-util: 29.6.2 jest-message-util: 29.6.2
jest-regex-util: 29.4.3 jest-regex-util: 29.4.3
@ -1379,7 +1379,7 @@ packages:
dependencies: dependencies:
'@jest/fake-timers': 29.6.2 '@jest/fake-timers': 29.6.2
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/node': 20.4.5 '@types/node': 20.4.7
jest-mock: 29.6.2 jest-mock: 29.6.2
dev: true dev: true
@ -1406,7 +1406,7 @@ packages:
dependencies: dependencies:
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@sinonjs/fake-timers': 10.3.0 '@sinonjs/fake-timers': 10.3.0
'@types/node': 20.4.5 '@types/node': 20.4.7
jest-message-util: 29.6.2 jest-message-util: 29.6.2
jest-mock: 29.6.2 jest-mock: 29.6.2
jest-util: 29.6.2 jest-util: 29.6.2
@ -1439,7 +1439,7 @@ packages:
'@jest/transform': 29.6.2 '@jest/transform': 29.6.2
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@jridgewell/trace-mapping': 0.3.18 '@jridgewell/trace-mapping': 0.3.18
'@types/node': 20.4.5 '@types/node': 20.4.7
chalk: 4.1.2 chalk: 4.1.2
collect-v8-coverage: 1.0.2 collect-v8-coverage: 1.0.2
exit: 0.1.2 exit: 0.1.2
@ -1527,7 +1527,7 @@ packages:
'@jest/schemas': 29.6.0 '@jest/schemas': 29.6.0
'@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-lib-coverage': 2.0.4
'@types/istanbul-reports': 3.0.1 '@types/istanbul-reports': 3.0.1
'@types/node': 20.4.5 '@types/node': 20.4.7
'@types/yargs': 17.0.24 '@types/yargs': 17.0.24
chalk: 4.1.2 chalk: 4.1.2
dev: true dev: true
@ -1642,7 +1642,7 @@ packages:
/@types/graceful-fs@4.1.6: /@types/graceful-fs@4.1.6:
resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==} resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==}
dependencies: dependencies:
'@types/node': 20.4.5 '@types/node': 20.4.7
dev: true dev: true
/@types/istanbul-lib-coverage@2.0.4: /@types/istanbul-lib-coverage@2.0.4:
@ -1665,8 +1665,8 @@ packages:
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
dev: true dev: true
/@types/node@20.4.5: /@types/node@20.4.7:
resolution: {integrity: sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg==} resolution: {integrity: sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g==}
dev: true dev: true
/@types/stack-utils@2.0.1: /@types/stack-utils@2.0.1:
@ -1883,8 +1883,8 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true hasBin: true
dependencies: dependencies:
caniuse-lite: 1.0.30001518 caniuse-lite: 1.0.30001519
electron-to-chromium: 1.4.480 electron-to-chromium: 1.4.485
node-releases: 2.0.13 node-releases: 2.0.13
update-browserslist-db: 1.0.11(browserslist@4.21.10) update-browserslist-db: 1.0.11(browserslist@4.21.10)
dev: true dev: true
@ -1921,8 +1921,8 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/caniuse-lite@1.0.30001518: /caniuse-lite@1.0.30001519:
resolution: {integrity: sha512-rup09/e3I0BKjncL+FesTayKtPrdwKhUufQFd3riFw1hHg8JmIFoInYfB102cFcY/pPgGmdyl/iy+jgiDi2vdA==} resolution: {integrity: sha512-0QHgqR+Jv4bxHMp8kZ1Kn8CH55OikjKJ6JmKkZYP1F3D7w+lnFXF70nG5eNfsZS89jadi5Ywy5UCSKLAglIRkg==}
dev: true dev: true
/chalk@2.4.2: /chalk@2.4.2:
@ -2094,8 +2094,8 @@ packages:
engines: {node: '>=0.3.1'} engines: {node: '>=0.3.1'}
dev: true dev: true
/electron-to-chromium@1.4.480: /electron-to-chromium@1.4.485:
resolution: {integrity: sha512-IXTgg+bITkQv/FLP9FjX6f9KFCs5hQWeh5uNSKxB9mqYj/JXhHDbu+ekS43LVvbkL3eW6/oZy4+r9Om6lan1Uw==} resolution: {integrity: sha512-1ndQ5IBNEnFirPwvyud69GHL+31FkE09gH/CJ6m3KCbkx3i0EVOrjwz4UNxRmN9H8OVHbC6vMRZGN1yCvjSs9w==}
dev: true dev: true
/emittery@0.13.1: /emittery@0.13.1:
@ -2164,7 +2164,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies: dependencies:
'@jest/expect-utils': 29.6.2 '@jest/expect-utils': 29.6.2
'@types/node': 20.4.5 '@types/node': 20.4.7
jest-get-type: 29.4.3 jest-get-type: 29.4.3
jest-matcher-utils: 29.6.2 jest-matcher-utils: 29.6.2
jest-message-util: 29.6.2 jest-message-util: 29.6.2
@ -2325,8 +2325,8 @@ packages:
binary-extensions: 2.2.0 binary-extensions: 2.2.0
dev: true dev: true
/is-core-module@2.12.1: /is-core-module@2.13.0:
resolution: {integrity: sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==} resolution: {integrity: sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==}
dependencies: dependencies:
has: 1.0.3 has: 1.0.3
dev: true dev: true
@ -2429,7 +2429,7 @@ packages:
'@jest/expect': 29.6.2 '@jest/expect': 29.6.2
'@jest/test-result': 29.6.2 '@jest/test-result': 29.6.2
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/node': 20.4.5 '@types/node': 20.4.7
chalk: 4.1.2 chalk: 4.1.2
co: 4.6.0 co: 4.6.0
dedent: 1.5.1 dedent: 1.5.1
@ -2450,7 +2450,7 @@ packages:
- supports-color - supports-color
dev: true 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==} resolution: {integrity: sha512-TT6O247v6dCEX2UGHGyflMpxhnrL0DNqP2fRTKYm3nJJpCTfXX3GCMQPGFjXDoj0i5/Blp3jriKXFgdfmbYB6Q==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true hasBin: true
@ -2467,7 +2467,7 @@ packages:
exit: 0.1.2 exit: 0.1.2
graceful-fs: 4.2.11 graceful-fs: 4.2.11
import-local: 3.1.0 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-util: 29.6.2
jest-validate: 29.6.2 jest-validate: 29.6.2
prompts: 2.4.2 prompts: 2.4.2
@ -2479,7 +2479,7 @@ packages:
- ts-node - ts-node
dev: true 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==} resolution: {integrity: sha512-VxwFOC8gkiJbuodG9CPtMRjBUNZEHxwfQXmIudSTzFWxaci3Qub1ddTRbFNQlD/zUeaifLndh/eDccFX4wCMQw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
peerDependencies: peerDependencies:
@ -2494,7 +2494,7 @@ packages:
'@babel/core': 7.22.9 '@babel/core': 7.22.9
'@jest/test-sequencer': 29.6.2 '@jest/test-sequencer': 29.6.2
'@jest/types': 29.6.1 '@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) babel-jest: 29.6.2(@babel/core@7.22.9)
chalk: 4.1.2 chalk: 4.1.2
ci-info: 3.8.0 ci-info: 3.8.0
@ -2514,7 +2514,7 @@ packages:
pretty-format: 29.6.2 pretty-format: 29.6.2
slash: 3.0.0 slash: 3.0.0
strip-json-comments: 3.1.1 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: transitivePeerDependencies:
- babel-plugin-macros - babel-plugin-macros
- supports-color - supports-color
@ -2555,7 +2555,7 @@ packages:
'@jest/environment': 29.6.2 '@jest/environment': 29.6.2
'@jest/fake-timers': 29.6.2 '@jest/fake-timers': 29.6.2
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/node': 20.4.5 '@types/node': 20.4.7
jest-mock: 29.6.2 jest-mock: 29.6.2
jest-util: 29.6.2 jest-util: 29.6.2
dev: true dev: true
@ -2571,7 +2571,7 @@ packages:
dependencies: dependencies:
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/graceful-fs': 4.1.6 '@types/graceful-fs': 4.1.6
'@types/node': 20.4.5 '@types/node': 20.4.7
anymatch: 3.1.3 anymatch: 3.1.3
fb-watchman: 2.0.2 fb-watchman: 2.0.2
graceful-fs: 4.2.11 graceful-fs: 4.2.11
@ -2622,7 +2622,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies: dependencies:
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/node': 20.4.5 '@types/node': 20.4.7
jest-util: 29.6.2 jest-util: 29.6.2
dev: true dev: true
@ -2663,7 +2663,7 @@ packages:
jest-pnp-resolver: 1.2.3(jest-resolve@29.6.2) jest-pnp-resolver: 1.2.3(jest-resolve@29.6.2)
jest-util: 29.6.2 jest-util: 29.6.2
jest-validate: 29.6.2 jest-validate: 29.6.2
resolve: 1.22.2 resolve: 1.22.4
resolve.exports: 2.0.2 resolve.exports: 2.0.2
slash: 3.0.0 slash: 3.0.0
dev: true dev: true
@ -2677,7 +2677,7 @@ packages:
'@jest/test-result': 29.6.2 '@jest/test-result': 29.6.2
'@jest/transform': 29.6.2 '@jest/transform': 29.6.2
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/node': 20.4.5 '@types/node': 20.4.7
chalk: 4.1.2 chalk: 4.1.2
emittery: 0.13.1 emittery: 0.13.1
graceful-fs: 4.2.11 graceful-fs: 4.2.11
@ -2708,7 +2708,7 @@ packages:
'@jest/test-result': 29.6.2 '@jest/test-result': 29.6.2
'@jest/transform': 29.6.2 '@jest/transform': 29.6.2
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/node': 20.4.5 '@types/node': 20.4.7
chalk: 4.1.2 chalk: 4.1.2
cjs-module-lexer: 1.2.3 cjs-module-lexer: 1.2.3
collect-v8-coverage: 1.0.2 collect-v8-coverage: 1.0.2
@ -2760,7 +2760,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies: dependencies:
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/node': 20.4.5 '@types/node': 20.4.7
chalk: 4.1.2 chalk: 4.1.2
ci-info: 3.8.0 ci-info: 3.8.0
graceful-fs: 4.2.11 graceful-fs: 4.2.11
@ -2785,7 +2785,7 @@ packages:
dependencies: dependencies:
'@jest/test-result': 29.6.2 '@jest/test-result': 29.6.2
'@jest/types': 29.6.1 '@jest/types': 29.6.1
'@types/node': 20.4.5 '@types/node': 20.4.7
ansi-escapes: 4.3.2 ansi-escapes: 4.3.2
chalk: 4.1.2 chalk: 4.1.2
emittery: 0.13.1 emittery: 0.13.1
@ -2797,13 +2797,13 @@ packages:
resolution: {integrity: sha512-l3ccBOabTdkng8I/ORCkADz4eSMKejTYv1vB/Z83UiubqhC1oQ5Li6dWCyqOIvSifGjUBxuvxvlm6KGK2DtuAQ==} resolution: {integrity: sha512-l3ccBOabTdkng8I/ORCkADz4eSMKejTYv1vB/Z83UiubqhC1oQ5Li6dWCyqOIvSifGjUBxuvxvlm6KGK2DtuAQ==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies: dependencies:
'@types/node': 20.4.5 '@types/node': 20.4.7
jest-util: 29.6.2 jest-util: 29.6.2
merge-stream: 2.0.0 merge-stream: 2.0.0
supports-color: 8.1.1 supports-color: 8.1.1
dev: true 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==} resolution: {integrity: sha512-8eQg2mqFbaP7CwfsTpCxQ+sHzw1WuNWL5UUvjnWP4hx2riGz9fPSzYOaU5q8/GqWn1TfgZIVTqYJygbGbWAANg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true hasBin: true
@ -2816,7 +2816,7 @@ packages:
'@jest/core': 29.6.2(ts-node@10.9.1) '@jest/core': 29.6.2(ts-node@10.9.1)
'@jest/types': 29.6.1 '@jest/types': 29.6.1
import-local: 3.1.0 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: transitivePeerDependencies:
- '@types/node' - '@types/node'
- babel-plugin-macros - babel-plugin-macros
@ -3197,11 +3197,11 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/resolve@1.22.2: /resolve@1.22.4:
resolution: {integrity: sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==} resolution: {integrity: sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==}
hasBin: true hasBin: true
dependencies: dependencies:
is-core-module: 2.12.1 is-core-module: 2.13.0
path-parse: 1.0.7 path-parse: 1.0.7
supports-preserve-symlinks-flag: 1.0.0 supports-preserve-symlinks-flag: 1.0.0
dev: true dev: true
@ -3406,7 +3406,7 @@ packages:
babel-jest: 29.6.2(@babel/core@7.22.9) babel-jest: 29.6.2(@babel/core@7.22.9)
bs-logger: 0.2.6 bs-logger: 0.2.6
fast-json-stable-stringify: 2.1.0 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 jest-util: 29.6.2
json5: 2.2.3 json5: 2.2.3
lodash.memoize: 4.1.2 lodash.memoize: 4.1.2
@ -3416,7 +3416,7 @@ packages:
yargs-parser: 21.1.1 yargs-parser: 21.1.1
dev: true 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==} resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
@ -3435,7 +3435,7 @@ packages:
'@tsconfig/node12': 1.0.11 '@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3 '@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4 '@tsconfig/node16': 1.0.4
'@types/node': 20.4.5 '@types/node': 20.4.7
acorn: 8.10.0 acorn: 8.10.0
acorn-walk: 8.2.0 acorn-walk: 8.2.0
arg: 4.1.3 arg: 4.1.3

View File

@ -13,8 +13,7 @@ describe('mapping properties with rich mapping engine', () => {
let Mapping_engine = new mapping_engine(mappingRemoveAll) let Mapping_engine = new mapping_engine(mappingRemoveAll)
let mapped_point = { properties: []} let mapped_point = Mapping_engine.mapElementFromConf(testingGeoJson.features[0])
mapped_point = Mapping_engine.mapElementFromConf(testingGeoJson.features[0])
expect(mapped_point.properties).toBe([]) expect(mapped_point.properties).toBe([])
}) })

View File

@ -1,3 +1,30 @@
module.exports= { 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"
]
} }