This commit is contained in:
Tykayn 2023-07-31 19:49:09 +02:00 committed by tykayn
commit f879a84311
42 changed files with 7180912 additions and 36 deletions

View File

@ -1,48 +1,56 @@
// lister les dossiers dans le dossier stockage syncable pour en tirer une liste de dates d'évènements
import fs from 'fs';
import fs from 'fs'
let suffix = ''
const folder_photo = `/home/poule/encrypted/stockage-syncable/photos${suffix}`;
const folder_photo = `/home/poule/encrypted/stockage-syncable/photos${suffix}`
/**
* obtenir une liste des dossiers uniquement dans le dossier courant
* @param path
* @returns {*}
*/
function getDirectories(path) {
return fs.readdirSync(path).filter(function (file) {
return fs.statSync(path + '/' + file).isDirectory();
});
function getDirectories (path) {
return fs.readdirSync(path).filter(function (file) {
return fs.statSync(path + '/' + file).isDirectory()
})
}
/**
* lister 3 sous niveaux de dossiers
* @param folders
*/
function recursiveListing(folders){
function recursiveListing (folders) {
for (let dossier of folders) {
for (let dossier of folders) {
dossier = dossier.trim()
console.log(folder_photo + '/' + dossier)
let subdir1 = folder_photo + '/' + dossier
let listing = getDirectories(subdir1)
if (listing.length) {
// console.log('', listing)
for (let d2 of listing) {
let subdir2 = folder_photo + '/' + dossier+'/'+d2
console.log(subdir2)
let listing2 = getDirectories(subdir1)
if (listing2.length) {
for (let d3 of listing2) {
let subdir3 = subdir2 +'/'+d3
console.log(subdir3)
}
}
dossier = dossier.trim()
console.log(folder_photo + '/' + dossier)
let subdir1 = folder_photo + '/' + dossier
let listing = getDirectories(subdir1)
if (listing.length) {
// console.log('', listing)
for (let d2 of listing) {
let subdir2 = folder_photo + '/' + dossier + '/' + d2
console.log(subdir2)
let listing2 = getDirectories(subdir1)
if (listing2.length) {
for (let d3 of listing2) {
let subdir3 = subdir2 + '/' + d3
console.log(subdir3)
}
}
}
let listing3 = getDirectories(subdir2)
if (listing3.length) {
for (let d4 of listing3) {
let subdir4 = subdir3 + '/' + d4
console.log(subdir4)
}
}
}
}
}
}
}
}
/**

View File

@ -0,0 +1,25 @@
# Conversion de jeux de données geojson en tags OSM
installation
```bash
npm i
npm i -g geojsontoosm
```
## Tout convertir faire d'un coup
Pour récupérer le jeu de données pour les bornes elec et convertir le geojson en fichier osm, lancer le script bash
```bash
bash refresh_data.sh
```
## config
Configurer le filtre de département et les autres options dans convert_to_osm_tags.mjs.
## utilisation
```bash
node convert_to_osm_tags.mjs
```
résultat en json dans le dossier output.
La sortie est filtrée selon le mappage donné et la zone de code postal de la config.
Réalisé pour l'intégration des bornes elec.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,384 @@
{
"count": 18,
"items": [
{
"lat": 50.0743484,
"lng": 1.537268,
"icon": "cluster.png",
"type": "cluster",
"count": 33
},
{
"lat": 49.6465569,
"lng": 0.595749,
"icon": "cluster.png",
"type": "cluster",
"count": 31
},
{
"lat": 49.9614983,
"lng": 1.1935092,
"icon": "cluster.png",
"type": "cluster",
"count": 26
},
{
"lat": 50.1074982,
"lng": 1.8426746,
"icon": "cluster.png",
"type": "cluster",
"count": 24
},
{
"lat": 50.2155533,
"lng": 1.628114,
"icon": "cluster.png",
"type": "cluster",
"count": 22
},
{
"lat": 49.6115227,
"lng": 0.7733023,
"icon": "cluster.png",
"type": "cluster",
"count": 21
},
{
"lat": 49.9128304,
"lng": 1.0857821,
"icon": "cluster.png",
"type": "cluster",
"count": 20
},
{
"lat": 49.8144035,
"lng": 0.657026,
"icon": "cluster.png",
"type": "cluster",
"count": 16
},
{
"lat": 49.8280449,
"lng": 0.911511,
"icon": "cluster.png",
"type": "cluster",
"count": 15
},
{
"lat": 49.5984917,
"lng": 1.1111569,
"icon": "cluster.png",
"type": "cluster",
"count": 14
},
{
"lat": 49.6525497,
"lng": 1.6158921,
"icon": "cluster.png",
"type": "cluster",
"count": 11
},
{
"lat": 49.7663574,
"lng": 1.7457,
"icon": "cluster.png",
"type": "cluster",
"count": 9
},
{
"lat": 49.9557304,
"lng": 1.767372,
"icon": "cluster.png",
"type": "cluster",
"count": 7
},
{
"lat": 49.8437424,
"lng": 1.7790869,
"icon": "cluster.png",
"type": "cluster",
"count": 3
},
{
"lat": 49.6544685,
"lng": 1.832823,
"icon": "cluster.png",
"type": "cluster",
"count": 2
},
{
"lat": 49.5701447,
"lng": 0.4898517,
"icon": "cluster.png",
"type": "cluster",
"count": 2
},
{
"lat": 49.5702896,
"lng": 1.609848,
"icon": "icon-accelerated_on.png",
"type": "pool",
"pool": {
"amenities": [],
"city": "Saumont-la-Poterie",
"real_time_available": true,
"rating": null,
"i18n_country_id": 67,
"emsps": [],
"gps_coordinates": {
"lon": 1.609848,
"lat": 49.5702896
},
"street_name": "358 Route de Paris ",
"speed": {
"icon": "accelerated.svg",
"self": "charging_speeds/3.json",
"id": 3,
"map_icon": "accelerated.png"
},
"should_check_prices": true,
"number": null,
"schedules": [],
"object_state_id": 2,
"is_indoor": false,
"id": 285402,
"slug": "eco-pi-saumont-la-poterie-358-route-de-paris",
"can_remote_start_charge": false,
"statistic": {
"global_note_average": null,
"price_note_average": null,
"location_note_average": null,
"security_note_average": null,
"comments_count": 0,
"reports_count": 0,
"checkins_count": 0,
"material_note_average": null,
"creation_date": "2023-07-29T02:04:10+00:00",
"ratings_count": 1
},
"can_update_charging_pool": false,
"is_always_open": true,
"can_charge_with_chargemap": true,
"location_type_id": 21,
"network_id": 2340,
"evse_emi3_ids": [
"FR*EPI*E11734505*1"
],
"charging_connectors": [
{
"count": 5,
"available_count": 3,
"evse_ids": [
701375,
701376,
701379,
701377,
701378
],
"type": "MENNEKES_TYPE_2",
"connector_type": {
"id": 14,
"icon": "type2"
},
"power_max": 22
}
],
"is_free": false,
"name": "Eco-PI - Saumont-la-Poterie - 358 Route de Paris ",
"location_type_slug": "unknown",
"charging_speed_id": 3,
"postal_code": "76440",
"country_code": "FR",
"is_tesla": false,
"evses": [
{
"id": 701375,
"is_available": true,
"realtime_state": "AVAILABLE"
},
{
"id": 701376,
"is_available": true,
"realtime_state": "AVAILABLE"
},
{
"id": 701379,
"is_available": true,
"realtime_state": "AVAILABLE"
},
{
"id": 701377,
"is_available": false,
"realtime_state": "OUT_OF_ORDER"
},
{
"id": 701378,
"is_available": false,
"realtime_state": "OUT_OF_ORDER"
}
]
}
},
{
"lat": 49.5693893,
"lng": 0.953997,
"icon": "icon-accelerated_on.png",
"type": "pool",
"pool": {
"amenities": [
"drinks",
"restoration",
"shop",
"restroom"
],
"city": "Pavilly",
"real_time_available": true,
"rating": 4,
"i18n_country_id": 67,
"emsps": [
10,
75,
77,
107,
108,
112
],
"gps_coordinates": {
"lon": 0.953997,
"lat": 49.5693893
},
"street_name": "Place du Président d'Esneval",
"speed": {
"icon": "accelerated.svg",
"self": "charging_speeds/3.json",
"id": 3,
"map_icon": "accelerated.png"
},
"should_check_prices": true,
"number": "4",
"schedules": [],
"object_state_id": 2,
"is_indoor": false,
"id": 105727,
"slug": "sde76-place-du-president-desneval-4-pavilly",
"can_remote_start_charge": false,
"statistic": {
"global_note_average": 4,
"price_note_average": 5,
"location_note_average": 2,
"security_note_average": 5,
"comments_count": 0,
"reports_count": 0,
"checkins_count": 25,
"material_note_average": 2,
"creation_date": "2023-07-29T02:01:25+00:00",
"ratings_count": 1
},
"can_update_charging_pool": false,
"is_always_open": true,
"can_charge_with_chargemap": true,
"location_type_id": 4,
"network_id": 404,
"evse_emi3_ids": [
"FR*S76*E100*1*1"
],
"charging_connectors": [
{
"count": 4,
"available_count": 2,
"evse_ids": [
25003,
25004,
390745,
390747
],
"type": "DOMESTIC_TYPE_F",
"connector_type": {
"id": 6,
"icon": "schuko"
},
"power_max": 3
},
{
"count": 7,
"available_count": 4,
"evse_ids": [
25003,
25004,
390745,
390747,
390662,
390663,
390664
],
"type": "MENNEKES_TYPE_2",
"connector_type": {
"id": 14,
"icon": "type2"
},
"power_max": 22
},
{
"count": 3,
"available_count": 2,
"evse_ids": [
390662,
390663,
390664
],
"type": "DOMESTIC_TYPE_F",
"connector_type": {
"id": 6,
"icon": "schuko"
},
"power_max": 2
}
],
"is_free": false,
"name": "SDE76 - Place du Président d'Esneval, 4 - Pavilly",
"location_type_slug": "parking",
"charging_speed_id": 3,
"postal_code": "76570",
"country_code": "FR",
"is_tesla": false,
"evses": [
{
"id": 25003,
"is_available": true,
"realtime_state": "AVAILABLE"
},
{
"id": 25004,
"is_available": true,
"realtime_state": "AVAILABLE"
},
{
"id": 390745,
"is_available": false,
"realtime_state": "OUT_OF_ORDER"
},
{
"id": 390747,
"is_available": false,
"realtime_state": "OUT_OF_ORDER"
},
{
"id": 390662,
"is_available": false,
"realtime_state": "OUT_OF_ORDER"
},
{
"id": 390663,
"is_available": true,
"realtime_state": "AVAILABLE"
},
{
"id": 390664,
"is_available": true,
"realtime_state": "AVAILABLE"
}
]
}
}
]
}

View File

@ -0,0 +1,231 @@
/**
* convertisseur de données de bornes de recharge électrique à partir de données Chargemap et open data Etalab
*/
import fs from 'node-fs'
import minimist from 'minimist'
import mappingConfigIRVE from './mappings/converters/configIRVE.mjs'
import mappingConfigIRVE_simple from './mappings/converters/mappingConfigIRVE_simple.mjs'
import mapping_engine from './mappings/engine.mjs'
import custom_utils from './mappings/utils.mjs'
const { debugLog } = custom_utils
const { isBooleanKey } = custom_utils
const { writeFile } = custom_utils
// let debugLog = custom_utils.debugLog
let use_mappping_engine = false
use_mappping_engine = true
let Mapping_engine = new mapping_engine(mappingConfigIRVE)
let mini_arguments = minimist(process.argv.slice(2))
// let sourceFileChargemapJson = './chargemap_data/hurepoix.json'
let sourceFilePathGeoJson = './etalab_data/latest.json'
// wip filter
let filterOnBoundingBox = true
filterOnBoundingBox = false
let boundingBoxCoordinates = {
xMin: 1.91,
xMax: 2.38,
yMin: 48.7,
yMax: 48.4,
}
let filterCoordinates = true
let enable_filter_on_department = true
enable_filter_on_department = false
let filterDepartment = 91
if (mini_arguments['department']) {
filterDepartment = mini_arguments['department']
}
if (mini_arguments['source']) {
sourceFilePathGeoJson = mini_arguments['source']
}
let filterZipCode = new RegExp(`^${filterDepartment}`)
let filterZipCodeAdresse = new RegExp(` ${filterDepartment}`)
let filteredName = ''
if (enable_filter_on_department) {
filteredName = '_filtered_zipcode_' + filterDepartment
} else if (filterOnBoundingBox) {
filteredName = '_filtered_bbox_' + boundingBoxCoordinates.xMin + '-' + boundingBoxCoordinates.xMax + '_' + boundingBoxCoordinates.yMin + '-' + boundingBoxCoordinates.yMax
}
let pointCounterMax = 1000000
let limitConversionToFirstPoint = false
limitConversionToFirstPoint = true
if (limitConversionToFirstPoint) {
pointCounterMax = 2
}
let defaultPropertiesOfPoint = {
'amenity': 'charging_station'
}
let 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) {
let point_counter = 0
if (err) {
return debugLog(err)
}
let 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
let 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(feature_point => {
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é')
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)
)
}
// 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)
let mapped_point = {}
if (use_mappping_engine) {
console.log('go mapping engine')
Mapping_engine.setConfig(mapping)
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)
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) {
let mappingKeys = Object.keys(mappingConfig)
let featurePointPropertiesKeys = Object.keys(featurePoint.properties)
debugLog('keys', mappingKeys, featurePointPropertiesKeys)
let newProperties = defaultPropertiesOfPoint
// 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 => {
if (mappingKeys.indexOf(pointKeyName) !== -1) {
debugLog('found element', pointKeyName, '=>', mappingConfig[pointKeyName], 'value : ', featurePoint.properties[pointKeyName])
let convertedValue = ''
if (isBooleanKey(pointKeyName)) {
let 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)
convertDataForIRVE(sourceFilePathGeoJson, mappingConfigIRVE, pointCounterMax, boundingBoxCoordinates)
} else {
convertDataForIRVE(sourceFilePathGeoJson, mappingConfigIRVE_simple, pointCounterMax, boundingBoxCoordinates)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,315 @@
# info sur les jeux de données
D'après le jeu de données Etalab
## liste des 310 opérateurs
270 AGENCY
2Ed Coutances
2F Production
ABSOLUT CONCEPT
Acelec Charge
advenir@zeborne.com
Aeroports de lyon
Allego
ALLENERGIES
alterna energie
ALU GRANON
Ambroise Avocat
ANYOS
AQUA LOISIRS
AREA Tech
ART DECO FINITION
arteco44
ATELIERS PROVENCE LOISIRS
Atlante | FR*ATL
ATRACHATA
Autel Netherlands B.V. | FR*AUT
Automobile de l'Est
AUTORECHARGE
AUTORECHARGE
AUTORECHARGE SAS
Avomarks
Bastide beaudinard & tours (BBT)
BAUDUCEL
Bénédictines du Sacré-Coeur de Montmartre
BH RESTAURATION
BIARS DISTRIBUTION
BORNECO
Borneco | FR*BHM
Bornevo
Bornevo Connect
Bouygues Energies et Services
BOUYGUES ENERGIES ET SERVICES
box
Camping des graniers
CAP EMPLOI
CAR2PLUG
CHAPITEAUX SERVICE
ChargePoint
Chargepoint
CHARGEPOLY
CHARRIERE DISTRIBUTION
CHATEAU DE RONZIERE
COMMUNAUTE DE COMMUNE LE DOURDANNAIS EN HUREPOIX (CCDH)
contact@autorecharge.fr
COPRODEX
Daltoner Avranches
Daltoner Caen
DALTONER CHERBOURG
Daltoner Granville
Daltoner Vire
DIDIER CHARTON-VACHET
Dropnplug
e-nergyze
E-TOTEM
E-totem
Easycharge services
Ecophi mobility
EcoPhi mobility
EDF
EDFRAY
EGE NOEL BERANGER
EGSM
EIZMENDI TRAITEUR EVENEMENTS
Ekoplug
ELEC eCONNECT
ELECTRA
ELECTRIC 55 CHARGING
Electriox Groupe
electromaps
ELECTROMAPS
Electromaps
ELEK BORDEAUX
ENERGEM
ENERGIE Eure-et-Loir
ENERGIE EURE-ET-LOIR
ENNESSER ET FILS
ENTREPRISE ADAM
ESPACE AUTO COURNON
Est Auto
EURO TAXI LINE
EV MAP SAS
EVBOX
EVERON
EVzen (SMEG Développement)
evzen (SMEG Développement)
evZen | FR*EVZ
F.B. AUTOMOBILES
Festilight
Freshmile
FRESHMILE
freshmile
FReshmile
Freshmile SAS
GABMAG17
GABORIT BOCAGE SERVICES
Gamba et Rota
GARAGE HENRY
garage Henry herve
Garage lefebvre
GEDIBOIS BATI COLMAN
GENE ELEC 35
GF3e
Golf de La Wantzenau
Green Diffusion
Green Technologie
GREEN TECHNOLOGIE
Green To Wheel
GreenYellow | FR*GYM
GROFF SAS
GROUPE COURTOIS SOCOHY
GROUPE LGE
GROUPE LGE SOCIETE AUTOPLUG
Grunzke Beate
Guerin
H alu concept
HABT
HAEFELI
HERVE THERMIQUE
HFOOD PESSAC
HFOOD VILLENAVE
Hostellerie
Hotel Le Moulin
Hôtel MACCHI
Hôtel Restaurant Hubert Kieffer
ICS Scgilthigheim
IFERRO
INOUID
IONITY
Ispo france
IXINA Le Cres
IXINA Saint Jean de Védas
ixina Villeneuve-lès-Béziers
Izivia
JAV INVESTISSEMENT
jmd
JONNARD LES ISSAMBRES
Kallista BDR
KIEHL
Kotelon
LA CONCIERGERIE D'ISA.
La dilettante
La jabotte
La jardinerie d'aveze sarl
LA PRAIRIE
Lacotte
Lacotte Pierre
LANGON DISTRIBUTION
Last Mile Solutions
LE BISTRO D'HUGO
Le Capelan
Le Grand Large
Le Manoir de l'Isle
le Relais
LE REVE DE JANINE
Leclerc Millau
LEGA
LEGELEUX
Leroux Damien
Les jardins maraichers des bords de rance
LIDL, Nicolas Barbarin
LMS Informatique
LUMI'IN
M. Yannick PIERRE
M.A.J.U.
ma borne auto
ma Borne Auto
MABORNEAUTO
MAS DES OLIVES
MAS DU TERME
MAS GALOFFRE
Masseria
MEA ENERGIES
MEDIODENT
Mickael Auto
MOBELEC
Modulo
MODULO
Modulo énergies
MONTA
MOVIVE_Izivia
NEXTENEO
NM SECURELEC
NON CONCERNE
Non concerné
non concerné
Normatech
Normatech Lodmi
NVH
NW IECharge
OCR MAINTENANCE ELECTRONIQUE
PAS DITINERANCE
Pascal Chene
Perrin
perrin
PHARMACIE DE HUNDLING
Pilotage Maritime
PLAGECO DISTRIBUTION
Polybati
Prodici
ProperPhi
Provibat
PROVIRIDIS
Proviridis | FR*PVD
PTBG et associés
QoWatt
R3
Ramsay Pole Lille métropole
RechargerMonAuto
REGIE MUNICIPALE D'ELECTRICITE DE LOOS
Rencontre-handi
REVE
RICOME ET SADOUL AXA FRANCE
RONALEV
Royal Champagne
RSDA mobility
SA FOOTBALL CLUB DES GIRONDINS DE BORDEAUX
sa les broyers
Sanou électricité
SAP LABS FRANCE
SARL BEAUDRE BAUDOT
SARL JUMO
SARL LAFOURCADE
SARL LES BAINS DE ROYAN
SARL VAHE
SAS CHATEAU DE MEMANAT
SAS DE L'AILETTE
sas e-motum
SAS Lujasy
SAS Miodis
SAS Sabo
SATUJO
SCI LA COLLINE
SCI LA GRANGE DESSOUS
SCI LES RUISSEAUX
SCI Lounapiou
SCI NOKI
SCI OLYMPE
SCP ACANTHE DRIMARACCI
SDC CENTRE MEDICAL ARTZAMENDI
SDC ORDINAL
SECAL
Securecharge
See You Sun
SELARL PHARMACIE CEVENOLE
Séolis
SGA Industries
SIEGE 27
SIPECC
SNAM GROUPE
SNER RHONE-ALPES
société La Clérine
Société LEVAROY, Monsieur LEROY
Societe moderne d'isolation
Société Sigma Tec
Société SIPECC
Société Y
Sodetrel
SOLIDARAUTO 49
SOREGIES
SPBR1
SPIE CITYNETWORKS
STATIONS-E
Sud Camargue
Sud Hotel
TANAY Electricité
Technic Elec
themis
Thibal Distribution
TISSERANT
total énergie
Total marketing france
TotalEnergies Charging Services
TotalEnergies Marketing France
ubitricity
UBITRICITY GMBH
Vegetalis
Vigot
Ville de Riquewihr
Vincent
Virta
VIRTA
Volta Charging
WAAT
WAAT SAS | FR*W10
WAAT SAS | FR*W11
WAAT SAS | FR*WA1
WAAT SAS | FR*WA3
WAAT SAS | FR*WA4
WAAT SAS | FR*WA5
WAAT SAS | FR*WA6
WAAT SAS | FR*WA8
WAAT SAS | FR*WA9
WAAT SAS | FR*WAT
WattzHub | FR*SMI
web services advenir
Wedom
WeDoM
WeDoM.io
WeeCharge
WICKER TP
ZEBORNE
ZEborne
ZEENCO
Zen Construction

View File

@ -0,0 +1 @@
,tykayn,spaceship,29.07.2023 21:47,file:///home/tykayn/.config/libreoffice/4;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,113 @@
/**
* 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
*/
export default {
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', // conserver le tag de base
capacity: 'capacity', // conserver le tag de base
nom_amenageur: 'operator',
siren_amenageur: 'owner:ref:FR:SIREN',
nom_operateur: 'operator',
telephone_operateur: 'phone',
contact_operateur: 'email', // ici, on souhaite convertir la clé contact_operateur=bidule en email=bidule
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', // déjà au bon format
// 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"},
]
}
}
}
},
}

View File

@ -0,0 +1,43 @@
/**
* 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
*/
export default {
// ******* nombres
nbre_pdc: 'capacity',
// ******* textes
amenity: 'amenity', // conserver le tag de base
capacity: 'capacity', // conserver le tag de base
nom_amenageur: 'operator',
siren_amenageur: 'owner:ref:FR:SIREN',
nom_operateur: 'operator',
telephone_operateur: 'phone',
contact_operateur: 'email', // ici, on souhaite convertir la clé contact_operateur=bidule en email=bidule
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
}

View File

@ -0,0 +1,157 @@
import custom_utils from './utils.mjs'
const { debugLog } = custom_utils
let listOfBooleanKeys = Object.keys({
prise_type_ef: 'socket:typee',
prise_type_2: 'socket:type2',
prise_type_combo_ccs: 'socket:type2_combo',
prise_type_chademo: 'socket:chademo',
gratuit: 'fee',
paiement_acte: 'authentication:none',
paiement_cb: 'payment:credit_cards',
cable_t2_attache: 'socket:type2_cable',
})
export default class {
mapping_config = {}
constructor (mappingConfig) {
this.setConfig(mappingConfig)
}
setConfig (mappingConfig) {
this.mapping_config = mappingConfig
}
mapFeaturePoint (featurePointGeoJson) {
let geoJSONConvertedPoint = {}
geoJSONConvertedPoint.properties = { ...this.mapping_config.default_properties_of_point }
geoJSONConvertedPoint.type = featurePointGeoJson.type
geoJSONConvertedPoint.geometry = featurePointGeoJson.geometry
let props = featurePointGeoJson.properties
props.forEach((key, value) => {
})
return geoJSONConvertedPoint
}
isBooleanKey (pointKeyName) {
return listOfBooleanKeys.indexOf(pointKeyName) !== -1
}
truthyValues = ['true', 'True', 'TRUE', '1', 1]
falsyValues = ['false', 'False', 'FALSE', '0', 0]
/**
* retuns the converted element from mapping config if present, null otherwise
*/
mapElementFromConf (featurePoint) {
console.log('config_name', this.mapping_config.config_name)
let mappingKeys = Object.keys(this.mapping_config.tags)
let featurePointPropertiesKeys = Object.keys(featurePoint.properties)
console.log('keys', mappingKeys, featurePointPropertiesKeys)
let newProperties = Object.create(this.mapping_config.default_properties_of_point)
// 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 => {
if (!mappingKeys.indexOf(pointKeyName) !== -1) {
debugLog('found element', pointKeyName, '=>', this.mapping_config[pointKeyName], 'value : ', featurePoint.properties[pointKeyName])
let convertedValue = ''
let valueConvertedFromMapping = featurePoint.properties[pointKeyName]
let typeofValue = typeof valueConvertedFromMapping
let isStringValue = typeofValue === 'string'
console.log('typeof featurePoint.properties[pointKeyName] === \'string\'', typeofValue)
let isConfigMappingObject = typeofValue === 'string'
if (isStringValue) {
console.log('string value')
if (this.isBooleanKey(pointKeyName)) {
let lowerValue = (valueConvertedFromMapping + '').toLowerCase()
convertedValue = this.truthyValues.indexOf(lowerValue) ? 'yes' : 'no'
} else {
convertedValue = valueConvertedFromMapping
}
if (convertedValue) {
newProperties[this.mapping_config[pointKeyName]] = convertedValue
}
} else if (isConfigMappingObject) {
let newKey = ''
let 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) {
let keysConditionnalValues = Object.keys(configObject.conditional_values)
let isFoundValue = keysConditionnalValues.indexOf(valueConvertedFromMapping)
if (isFoundValue !== -1) {
let conditionnalConfig = keysConditionnalValues[isFoundValue]
if (conditionnalConfig.tags_to_add) {
// on peut définir un ensemble de tags à rajouter
newProperties.push(...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
}
}
}
})
debugLog('basePoint', basePoint)
return basePoint
}
}

View File

@ -0,0 +1,31 @@
let show_debug = 0
/**
* faire un log
* @param message
*/
function debugLog (message) {
if (!show_debug) {
return
}
console.log('debug: ', ...message)
}
/**
* TODO
* find the domain of all columns in a csv,
* take the header and the values, return only the unique values for each column, save a new csv,
and build a config for the mapping engine listing all the possible values.
* @param pointKeyName
* @returns {boolean}
*/
function openCSV (filePath) {
console.log('open csv filePath')
return
}
export default {
debugLog,
isBooleanKey
}

View File

@ -0,0 +1,61 @@
import fs from 'node-fs'
let show_debug = 1
/**
* faire un log
* @param message
*/
function debugLog (message) {
if (!show_debug) {
return
}
console.log('debug: ', message)
}
let listOfBooleanKeys = Object.keys({
prise_type_ef: 'socket:typee',
prise_type_2: 'socket:type2',
prise_type_combo_ccs: 'socket:type2_combo',
prise_type_chademo: 'socket:chademo',
gratuit: 'fee',
paiement_acte: 'authentication:none',
paiement_cb: 'payment:credit_cards',
cable_t2_attache: 'socket:type2_cable',
})
/**
*
* @param pointKeyName
* @returns {boolean}
*/
function isBooleanKey(pointKeyName) {
return listOfBooleanKeys.indexOf(pointKeyName) !== -1
}
function writeFile (fileName, fileContent) {
debugLog('write file ', fileName)
return fs.writeFile(
`./output/${fileName}`,
fileContent,
'utf8',
(err) => {
if (err) {
debugLog(`Error writing file: ${err}`)
} else {
debugLog(`File ${fileName} is written successfully!`)
}
}
)
}
export default
{
debugLog,
isBooleanKey,
writeFile
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
{
"name": "mapping_geojson_to_osm_tags",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"minimist": "^1.2.8",
"node-fs": "^0.1.7"
}
},
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/node-fs": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/node-fs/-/node-fs-0.1.7.tgz",
"integrity": "sha512-XqDBlmUKgDGe76+lZ/0sRBF3XW2vVcK07+ZPvdpUTK8jrvtPahUd0aBqJ9+ZjB01ANjZLuvK3O/eoMVmz62rpA==",
"os": [
"linux",
"darwin",
"freebsd",
"win32",
"smartos",
"sunos"
],
"engines": {
"node": ">=0.1.97"
}
}
}
}

View File

@ -0,0 +1,6 @@
{
"dependencies": {
"minimist": "^1.2.8",
"node-fs": "^0.1.7"
}
}

View File

@ -0,0 +1,18 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
node-fs:
specifier: ^0.1.7
version: 0.1.7
packages:
/node-fs@0.1.7:
resolution: {integrity: sha512-XqDBlmUKgDGe76+lZ/0sRBF3XW2vVcK07+ZPvdpUTK8jrvtPahUd0aBqJ9+ZjB01ANjZLuvK3O/eoMVmz62rpA==}
engines: {node: '>=0.1.97'}
os: [linux, darwin, freebsd, win32, smartos, sunos]
dev: false

View File

@ -0,0 +1,15 @@
#!/bin/bash
# get the updated geojson
#wget https://www.data.gouv.fr/fr/datasets/r/7eee8f09-5d1b-4f48-a304-5e99e8da1e26 -P ./etalab_data -O latest.json
# https://www.data.gouv.fr/fr/datasets/r/8d9398ae-3037-48b2-be19-412c24561fbb pour le jeu de données irve schema v2, non utilisé dans ce script
# filter its tags
nvm use stable
pnpm i
node convert_to_osm_tags.mjs
# convert the new geojson to osm file
geojsontoosm etalab_data/latest.json > osm_output/bornes-irve_all.osm
geojsontoosm output/my_converted_data_set.json > osm_output/bornes-irve-filetered-from-etalab-opendata.osm
echo "conversion faite"
# done

View File

@ -101,7 +101,7 @@ header
type: 'header',
children: [ [Circular *1] ],
level: 2,
fromLineNumber: 4,
fromLineNumber: 5,
previousSibling: {
type: 'inlineContainer',
children: [Array],
@ -122,7 +122,7 @@ header
type: 'header',
children: [Array],
level: 2,
fromLineNumber: 4,
fromLineNumber: 5,
previousSibling: [Object]
}
}
@ -145,7 +145,7 @@ header
type: 'header',
children: [ [Circular *1] ],
level: 3,
fromLineNumber: 9,
fromLineNumber: 11,
previousSibling: {
type: 'inlineContainer',
children: [Array],
@ -166,7 +166,7 @@ header
type: 'header',
children: [Array],
level: 3,
fromLineNumber: 9,
fromLineNumber: 11,
previousSibling: [Object]
}
}
@ -189,12 +189,12 @@ header
type: 'header',
children: [ [Circular *1] ],
level: 4,
fromLineNumber: 10,
fromLineNumber: 12,
previousSibling: {
type: 'header',
children: [Array],
level: 3,
fromLineNumber: 9,
fromLineNumber: 11,
previousSibling: [Object]
}
}
@ -212,7 +212,7 @@ header
type: 'header',
children: [Array],
level: 4,
fromLineNumber: 10,
fromLineNumber: 12,
previousSibling: [Object]
}
}

View File

@ -1,4 +1,4 @@
#!/bin/bash
echo "mise à jour du fichier de tâches orgmode du workflow nextcloud";
cp /home/cipherbliss/Nextcloud/textes/orgmode/tasks.org .
node index.js > output.txt
cp ~/Nextcloud/textes/orgmode/tasks.org .
node index.js > output.txt

14
package-lock.json generated
View File

@ -7,6 +7,7 @@
"name": "scripts-tykayn",
"dependencies": {
"exifr": "^7.1.3",
"minimist": "^1.2.8",
"moment": "^2.29.4",
"node-fs": "^0.1.7"
},
@ -4444,6 +4445,14 @@
"node": "*"
}
},
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
@ -8767,6 +8776,11 @@
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="
},
"moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",

View File

@ -2,6 +2,7 @@
"name": "scripts-tykayn",
"dependencies": {
"exifr": "^7.1.3",
"minimist": "^1.2.8",
"moment": "^2.29.4",
"node-fs": "^0.1.7"
},
@ -16,6 +17,7 @@
"ts-node": "^10.9.1"
},
"scripts": {
"devine": "node rangement/index.mjs",
"test": "jest"
}
}

8
rangement/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

6
rangement/.idea/misc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/rangement.iml" filepath="$PROJECT_DIR$/.idea/rangement.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
rangement/.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>