mapping working for osmose exports too

This commit is contained in:
Tykayn 2023-10-07 23:15:21 +02:00 committed by tykayn
parent 87159cee39
commit 9d8f687809
6 changed files with 741 additions and 225406 deletions

View File

@ -313,7 +313,13 @@ if (use_mapping_engine) {
debugLog(' - using mapping engine')
debugLog(' - pointCounterMax', pointCounterMax)
if(osmoseFormat){
Mapping_engine.setConfig(mappingConfigIRVEFromOsmose)
}else{
Mapping_engine.setConfig(mappingConfigIRVE)
}
let currentMappingConfig = Mapping_engine.getConfig();
convertDataForIRVE(sourceFilePathGeoJson, currentMappingConfig, pointCounterMax, boundingBoxCoordinates)

View File

@ -0,0 +1,548 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
6.079967,
45.894798
]
},
"properties": {
"uuid": "2d86616b-2f6b-d9bf-1e1d-3eb27f9f376c",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"email": "contact@nexteneo.com",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "GALILEO",
"capacity": "2",
"motorcar": "yes",
"operator": "NEXTENEO",
"ref:EU:EVSE": "FR*0NX*POOL8T9XK",
"socket:type2": "2",
"socket:typee": "1",
"opening_hours": "24/7"
}
}
]
],
"subtitle": "GALILEO, [178] [route de cran gevrier][74650][Chavanod], Recharge disponible aux heures d'ouverture, Badge, QRcode, Conditions accès suivant les EMSP",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
4.782551,
43.719317
]
},
"properties": {
"uuid": "928c424e-8fb4-e78a-4312-a7215ad88942",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"fee": "yes",
"email": "support@evzen.com",
"owner": "Communauté de communes Vallée des Baux-Alpilles",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "Simone",
"capacity": "2",
"motorcar": "yes",
"operator": "EVzen (SMEG Développement)",
"ref:EU:EVSE": "FR*ABA*POPUJ4UCI7I",
"socket:type2": "2",
"socket:typee": "2",
"opening_hours": "24/7",
"authentication:none": "yes",
"payment:credit_cards": "yes"
}
}
]
],
"subtitle": "Paradou, Parking Des coles, Parking Des coles 13520 PARADOU, None",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
4.805189,
43.722592
]
},
"properties": {
"uuid": "04e672d9-2e04-5940-41e4-ca55b17d015c",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"fee": "yes",
"email": "support@evzen.com",
"owner": "Communauté de communes Vallée des Baux-Alpilles",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "Simone",
"capacity": "2",
"motorcar": "yes",
"operator": "EVzen (SMEG Développement)",
"ref:EU:EVSE": "FR*ABA*PW1O0NOVXTC",
"socket:type2": "2",
"socket:typee": "2",
"opening_hours": "24/7",
"authentication:none": "yes",
"payment:credit_cards": "yes"
}
}
]
],
"subtitle": "Maussane-Les-Alpilles, Avenue Des Alpilles, Avenue Des Alpilles 13520 MAUSSANE-LES-ALPILLES, None",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
2.5568223,
48.6956687
]
},
"properties": {
"uuid": "abe86ca9-56e1-790b-c819-d2efdc81a99c",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"fee": "yes",
"email": "contact@e-totem.fr",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "Carrefour Contact Périgny",
"capacity": "2",
"motorcar": "yes",
"operator": "E-TOTEM",
"wheelchair": "yes",
"ref:EU:EVSE": "FR*CAR*P17274A",
"socket:type2": "2",
"socket:typee": "1",
"opening_hours": "24/7",
"authentication:none": "yes"
}
}
]
],
"subtitle": "Carrefour Contact Périgny, 8 Rte de Brie-Comte-Robert 94520 Périgny, None",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
9.445071,
41.995246
]
},
"properties": {
"uuid": "9d551e31-2b64-78e7-e1da-3c1768bebffc",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"fee": "yes",
"email": "support@virta.global",
"owner": "Camping Arinella",
"phone": "+33186472694",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "Réseau de recharge Virta Public",
"capacity": "2",
"motorcar": "yes",
"operator": "Virta",
"wheelchair": "yes",
"ref:EU:EVSE": "FR*E10*P20921",
"socket:type2": "1",
"socket:typee": "1",
"opening_hours": "24/7",
"authentication:none": "yes",
"payment:credit_cards": "no"
}
}
]
],
"subtitle": "Camping Arinella, Route de la mer, Brushetto - 20240 Ghisonaccia, Recharge uniquement disponible pendant ouverture du camping",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
4.64742,
45.4794
]
},
"properties": {
"uuid": "1c708eec-e130-551b-70ac-997222f473f0",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"fee": "yes",
"email": "contact@reseau-eborn.fr",
"owner": "SPBR1",
"phone": "+33423100350",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "eborn",
"capacity": "2",
"motorcar": "yes",
"operator": "SPBR1",
"ref:EU:EVSE": "FR*EBN*PAAVBTG",
"socket:type2": "2",
"socket:typee": "2",
"opening_hours": "24/7",
"authentication:none": "yes",
"payment:credit_cards": "yes"
}
}
]
],
"subtitle": "Sainte-Croix-En-Jarez, Parking aux portes, Parking aux portes 42800 Sainte-Croix-En-Jarez, Autre paiements : compte prépayé.",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
6.11126,
45.8969
]
},
"properties": {
"uuid": "ac66fcb3-b876-6f44-aa4f-86f437acee87",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"fee": "yes",
"email": "contact@reseau-eborn.fr",
"owner": "SPBR1",
"phone": "+33423100350",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "eborn",
"capacity": "2",
"motorcar": "yes",
"operator": "SPBR1",
"ref:EU:EVSE": "FR*EBN*PAJCWTT",
"socket:type2": "1",
"opening_hours": "24/7",
"socket:chademo": "1",
"socket:type2_combo": "1",
"authentication:none": "yes",
"payment:credit_cards": "yes"
}
}
]
],
"subtitle": "Annecy Cran-Gevrier, Rue Du Rond-Point, Rue Du Rond Point 74960 Annecy Cran-Gevrier, Autre paiements : compte prépayé.",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
3.30928,
46.5868
]
},
"properties": {
"uuid": "40f8e54e-5f80-6d15-a126-c6cce330bc88",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"fee": "yes",
"email": "contact@reseau-eborn.fr",
"owner": "SPBR1",
"phone": "+33423100350",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "eborn",
"capacity": "2",
"motorcar": "yes",
"operator": "SPBR1",
"ref:EU:EVSE": "FR*EBN*PAVERMES",
"socket:type2": "2",
"socket:typee": "2",
"opening_hours": "24/7",
"authentication:none": "yes",
"payment:credit_cards": "yes"
}
}
]
],
"subtitle": "Avermes, La Poste, Parking de la poste 03000 Avermes, Autre paiements : compte prépayé.",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
4.2564165,
45.4467313
]
},
"properties": {
"uuid": "dad7eded-be64-825f-6561-1afb717c3764",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"fee": "yes",
"email": "contact@reseau-eborn.fr",
"owner": "SPBR1",
"phone": "+33423100350",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "eborn",
"capacity": "2",
"motorcar": "yes",
"operator": "SPBR1",
"ref:EU:EVSE": "FR*EBN*PBKUKVCUG0Q",
"socket:type2": "2",
"socket:typee": "2",
"opening_hours": "24/7",
"authentication:none": "yes",
"payment:credit_cards": "yes"
}
}
]
],
"subtitle": "Saint-Victor-Sur-Loire, Parking rue de la plage, Parking rue de la plage 42230 Saint-Victor-Sur-Loire, Autre paiements : compte prépayé.",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
5.24093,
45.258479
]
},
"properties": {
"uuid": "688a8fc5-be07-3fd5-7e30-22101e2e3983",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"fee": "yes",
"email": "contact@reseau-eborn.fr",
"owner": "SPBR1",
"phone": "+33423100350",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "eborn",
"capacity": "2",
"motorcar": "yes",
"operator": "SPBR1",
"ref:EU:EVSE": "FR*EBN*PBYXYO6YXTR",
"socket:type2": "2",
"socket:typee": "2",
"opening_hours": "24/7",
"authentication:none": "yes",
"payment:credit_cards": "yes"
}
}
]
],
"subtitle": "Roybon, Place Jean Perraud, Place Jean Perraud 38940 Roybon, Autre paiements : compte prépayé.",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
6.077297,
44.682134
]
},
"properties": {
"uuid": "02b683a3-18bf-d0fc-bd83-68764a923e8d",
"item": 8410,
"class": 1,
"source_id": 417085,
"elems": null,
"fixes": [
[
{
"type": "N",
"create": {
"fee": "yes",
"email": "contact@reseau-eborn.fr",
"owner": "SPBR1",
"phone": "+33423100350",
"source": "data.gouv.fr:Etalab - 05/2022",
"amenity": "charging_station",
"network": "eborn",
"capacity": "2",
"motorcar": "yes",
"operator": "SPBR1",
"ref:EU:EVSE": "FR*EBN*PC3RYGMDUOZ",
"socket:type2": "2",
"socket:typee": "2",
"opening_hours": "24/7",
"authentication:none": "yes",
"payment:credit_cards": "yes"
}
}
]
],
"subtitle": "Saint-Bonnet-En-Champsaur, Place Waldems, Place Waldems 05500 Saint-Bonnet-En-Champsaur, Autre paiements : compte prépayé.",
"country": "france_local_db",
"analyser": "Merge_Charging_station_FR",
"title": "Car charging station not integrated",
"level": 3,
"timestamp": "2023-10-07T00:39:00+00:00",
"menu": "charging station",
"dat": -1
}
}
]
}

View File

@ -7,6 +7,7 @@ import MappingConfigType from "../mapping-config.type";
const MappingIRVEOsmose: MappingConfigType = {
config_name: "IRVE config for Osmose IRVE items",
osmose: true,
config_author: "tykayn <contact@cipherbliss.com>",
default_properties_of_point: {
'amenity': 'charging_station'
@ -29,18 +30,15 @@ const MappingIRVEOsmose: MappingConfigType = {
// {}
// ]
},
add_not_mapped_tags_too: false,
// add_not_mapped_tags_too: false,
add_not_mapped_tags_too: true,
tags: {
// ******* nombres
// ******* textes
// // ******* nombres
// // ******* textes
amenity: 'amenity', // conserver le tag de base
capacity: 'capacity', // conserver le tag de base
'owner:ref:FR:SIREN': 'owner:ref:FR:SIREN',
operator: 'operator',
// telephone_operateur: {
// key_converted: 'operator:phone',
// convert_to_phone: true, // conversion en format international si possible
// },
'operator:phone': {
key_converted: 'operator:phone',
convert_to_phone: true, // conversion en format international si possible
@ -49,48 +47,35 @@ const MappingIRVEOsmose: MappingConfigType = {
key_converted: 'phone',
convert_to_phone: true, // conversion en format international si possible
},
'operator:email': 'operator:email', // ici, on souhaite convertir la clé contact_operateur=bidule en email=bidule
'ref:EU:EVSE': 'ref:EU:EVSE',
// 'operator:email': 'operator:email', // ici, on souhaite convertir la clé contact_operateur=bidule en email=bidule
// 'ref:EU:EVSE': 'ref:EU:EVSE',
ref: 'ref',
/**
* l'info de gratuité a été mal renseignée par les opérateurs, ils mettent TRÈS souvent que c'est gratuit alors que ce n'est pas vrai.
*/
fee: 'fee',
'authentication': 'authentication',
'authentication:none': 'authentication:none',
// gratuit: {
// key_converted: 'fee',
// convert_to_boolean_value: true,
// invert_boolean_value: true,
// },
// paiement_acte:
// {
// key_converted: 'authentication:none',
// convert_to_boolean_value: true, // convertit en yes ou no
// },
reservation: 'reservation' ,
note: 'note',
fixme: 'fixme',
name: 'name',
network: 'network',
// ******* dates
start_date: 'start_date',
// ******** champs booléens
'socket:type2_cable':'socket:type2_cable' ,
'socket:typee': 'socket:typee',
'socket:type2': 'socket:type2',
'socket:type2_combo': 'socket:type2_combo',
'socket:chademo': 'socket:chademo',
// ******** champs plus complexes
opening_hours: 'opening_hours', // déjà au bon format
'payment:credit_cards': 'payment:credit_cards',
wheelchair: "wheelchair",
bicycle: "bicycle",
scooter: "scooter",
motorcar: "motorcar",
'socket:max:output': 'socket:max:output'
// name: 'name',
// network: 'network',
// // ******* dates
// start_date: 'start_date',
// // ******** champs booléens
// 'socket:type2_cable':'socket:type2_cable' ,
// 'socket:typee': 'socket:typee',
// 'socket:type2': 'socket:type2',
// 'socket:type2_combo': 'socket:type2_combo',
// 'socket:chademo': 'socket:chademo',
//
// // ******** champs plus complexes
// opening_hours: 'opening_hours', // déjà au bon format
// 'payment:credit_cards': 'payment:credit_cards',
// wheelchair: "wheelchair",
// bicycle: "bicycle",
// scooter: "scooter",
// motorcar: "motorcar",
// 'socket:max:output': 'socket:max:output'
//
},
}
export default MappingIRVE;
export default MappingIRVEOsmose;

View File

@ -109,7 +109,17 @@ export default class {
debugLog('mapElementFromConf: config_name', this.mapping_config.config_name)
let mappingKeys = Object.keys(this.mapping_config.tags)
let featurePointPropertiesKeys = Object.keys(featurePoint.properties)
let featurePointPropertiesKeys = []
if (this.mapping_config.osmose) {
// only creation of new points are handled by now [2023-10-07]
featurePointPropertiesKeys = Object.keys(featurePoint.properties.fixes[0][0].create)
console.log('featurePointPropertiesKeys', featurePointPropertiesKeys)
//
// return;
} else {
featurePointPropertiesKeys = Object.keys(featurePoint.properties)
}
debugLog('mapElementFromConf: ============= keys mappingKeys:', this.mapping_config.tags.length, mappingKeys.length)
debugLog('mapElementFromConf: ============= keys featurePointPropertiesKeys :', featurePoint.properties.length, featurePointPropertiesKeys.length)
@ -148,7 +158,15 @@ export default class {
convertProperty(pointKeyName: string, mappingKeys: any, featurePoint: any, newProperties: any) {
this.current_geojson_point = featurePoint
let originalValue = featurePoint.properties[pointKeyName]
let originalValue = ''
if (this.mapping_config.osmose) {
originalValue = featurePoint.properties.fixes[0][0].create[pointKeyName]
} else {
originalValue = featurePoint.properties[pointKeyName]
}
let intOriginalValue = parseInt(originalValue)
let mappingValueObject: any = '';
if (mappingKeys.indexOf(pointKeyName) !== -1) {
@ -300,7 +318,8 @@ export default class {
// let accepted_values = [3, 7, 22, 50, 150, 300]
// if (accepted_values.includes(converted_value)) {
let out = ''
if (originalValue < max_output) {
if (intOriginalValue < max_output) {
// enlever les lettres dans la valeur
out = converted_value + ' kW'
@ -308,11 +327,12 @@ export default class {
} else {
// console.log('too high kW value detected', originalValue)
// prise en charge des valeurs en Watts et non en kW.
if (originalValue > 1000 && originalValue < 401000) {
if (intOriginalValue > 1000 && intOriginalValue < 401000) {
let kilowatts = (parseFloat(converted_value) / 1000).toFixed(2).replace('.00', '');
out = ('' + kilowatts + ' kW').replace('.00', '')
// console.log('valeurs en Watts out', out, 'original:', originalValue)
this.stats.power_output++
}
}
out = (out).replace('.00', '')
@ -366,18 +386,19 @@ export default class {
}
if (configObject.invert_boolean_value) {
convertedValue = ! this.convertToBoolean(originalValue) ? 'yes' : 'no'
convertedValue = !this.convertToBoolean(originalValue) ? 'yes' : 'no'
console.log('invert boolean', convertedValue, originalValue)
}
if (configObject.convert_to_phone) {
/**
* nettoyer les numéros de téléphone en ne gardant que les nombres et le préfixe de pays
*/
debugLog('originalValue', originalValue.substring(1))
// debugLog('originalValue', originalValue.substring(1))
if (!originalValue) {
originalValue = ''
}
let original_without_spaces = originalValue.replace(/ /g, '')
let cleaned_value = `${original_without_spaces}`
cleaned_value = cleaned_value
@ -472,7 +493,6 @@ export default class {
debugLog('conditionnalConfig', conditionnalConfig)
if (conditionnalConfig.ignore_this_data) {
debugLog(`on ignore cette clé car sa valeur "${originalValue}" est à exclure: `, pointKeyName, '=>', newKey)
remove_original_key = true;
@ -560,9 +580,10 @@ export default class {
}
return convertedValue;
}
private convertToBoolean(originalValue: any) {
debugLog('convertProperty: ==========> original value', originalValue)
let convertedValue ;
let convertedValue;
if (this.truthyValues.indexOf(originalValue) !== -1) {
convertedValue = true
} else {

View File

@ -27,6 +27,7 @@ export interface BoundingBoxCoordinatesType{
export default interface MappingConfigType{
config_name: string,
config_author: string,
osmose?: boolean,
add_not_mapped_tags_too: boolean,
default_properties_of_point: object,
source: object,

File diff suppressed because it is too large Load Diff