mirror of
https://forge.chapril.org/tykayn/wololo
synced 2025-06-20 01:34:42 +02:00
réinit
This commit is contained in:
commit
996524bc6d
107 changed files with 1295536 additions and 0 deletions
116
mappings/converters/configArbresEchirolles.ts
Normal file
116
mappings/converters/configArbresEchirolles.ts
Normal file
|
@ -0,0 +1,116 @@
|
|||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
/**
|
||||
* conversion des données concernant les arbres de la ville d'Echirolles
|
||||
* lancement du script:
|
||||
*
|
||||
* ts-node convert_to_osm_tags.ts --source="etalab_data/abres/arbres_ech.json" --output-file="arbres-echirolles.geojson" --engine-config=MappingArbresEchirolles
|
||||
*
|
||||
* documentation sur les espèces d'arbres
|
||||
* nom : item wikidata
|
||||
* "Platanus acerifolia" Q24853030
|
||||
* "Tilia cordata" Q158746
|
||||
* "Liriodendron tulipifera" Q158783
|
||||
*/
|
||||
const MappingArbresEchirolles: MappingConfigType = {
|
||||
// add_not_mapped_tags_too: false,
|
||||
// source: undefined,
|
||||
config_name: 'Mapping des arbres d\'Echirolles',
|
||||
config_author: 'tykayn <contact+geojson2osm@cipherbliss.com>',
|
||||
default_properties_of_point: {natural: 'tree', source : 'Échirolles Métropole'},
|
||||
tags: {
|
||||
// ******* booléens
|
||||
// ******* nombres
|
||||
// - ID_ARBRE : ref:FR:issy_les_mx:id_arbre identifiant interne à Issy les Moulineaux
|
||||
"id_arbre": "ref:FR:Échirolles:id_arbre",
|
||||
// ******* textes
|
||||
"nom_latin": {
|
||||
key_converted: "species",
|
||||
conditional_values: {
|
||||
"Platanus acerifolia": {'tags_to_add': {"species:wikidata": "Q24853030"}},
|
||||
"Tilia cordata": {'tags_to_add': {"wikidata": "species:Q158746"}},
|
||||
"Liriodendron tulipifera": {'tags_to_add': {"species:wikidata": "Q158783"}},
|
||||
},
|
||||
},
|
||||
|
||||
// - CADUC_PERS : leaf_cycle=evergreen pour persistant , deciduous pour caduque
|
||||
// "caduc_pers": {
|
||||
// conditional_values: {
|
||||
// "Persistant ": {
|
||||
// 'tags_to_add':{
|
||||
// "leaf_cycle": "evergreen",
|
||||
// }
|
||||
// },
|
||||
// "Caduc ": {
|
||||
// 'tags_to_add':{
|
||||
// "leaf_cycle": "deciduous",
|
||||
// }
|
||||
// },
|
||||
// }
|
||||
// },
|
||||
// - FEUIL_CONI : feuillu leaf_type=broadleaved / connifère leaf_type=needleleaved
|
||||
// "feuil_coni": {
|
||||
// conditional_values: {
|
||||
// "Feuillu ": {
|
||||
// 'tags_to_add':{
|
||||
// "leaf_type": "broadleaved",
|
||||
// }
|
||||
// },
|
||||
// "Conifère ": {
|
||||
// 'tags_to_add':{
|
||||
// "leaf_type": "needleleaved",
|
||||
// }
|
||||
// },
|
||||
// }
|
||||
// },
|
||||
// - PARTICULAR : Majeur, Remarquable : historic=monument
|
||||
|
||||
// "particular": {
|
||||
// conditional_values: {
|
||||
// "Majeur ": {
|
||||
// 'tags_to_add':{
|
||||
// "historic": "monument",
|
||||
// },
|
||||
// },
|
||||
// "Remarquable ": {
|
||||
//
|
||||
// 'tags_to_add':{
|
||||
// "historic": "monument",
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
// },
|
||||
// - FORME: tree_shape = curtain / free / half_free <= Architecturé, rideau / Libre / Semi-libre
|
||||
// "forme": {
|
||||
// key_converted: "tree_shape",
|
||||
// conditional_values: {
|
||||
// "Architecturé, rideau ": {
|
||||
// 'tags_to_add':{
|
||||
// "tree_shape": "curtain",
|
||||
// },
|
||||
// },
|
||||
// "Semi-libre ": {
|
||||
// 'tags_to_add':{
|
||||
// "tree_shape": "half_free",
|
||||
// },
|
||||
// },
|
||||
// "Libre ": {
|
||||
// 'tags_to_add':{
|
||||
// "tree_shape": "free",
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
// },
|
||||
|
||||
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
source: {
|
||||
geojson_path: 'https://data.issy.com/api/explore/v2.1/catalog/datasets/arbres-remarquables-issy-les-moulineaux/exports/geojson?lang=fr&timezone=Europe%2FBerlin',
|
||||
url: 'https://www.data.gouv.fr/fr/datasets/arbres-remarquables'
|
||||
},
|
||||
filters: {
|
||||
// offset:10
|
||||
},
|
||||
}
|
||||
export default MappingArbresEchirolles
|
51
mappings/converters/configArbresHautsDeSeine.ts
Normal file
51
mappings/converters/configArbresHautsDeSeine.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingArbres92: MappingConfigType = {
|
||||
config_name: 'Mapping des arbres d\'Issy les Moulineaux',
|
||||
config_author: 'tykayn <contact+geojson2osm@cipherbliss.com>',
|
||||
default_properties_of_point: {natural: 'tree'},
|
||||
tags: {
|
||||
// ******* booléens
|
||||
// ******* nombres
|
||||
// - ID_ARBRE : ref:FR:issy_les_mx:id_arbre identifiant interne à Issy les Moulineaux
|
||||
"idelement_vert": "ref:FR:cadastre_vert:id_element_vert",
|
||||
"type": "ref:FR:cadastre_vert:type",
|
||||
// ******* textes
|
||||
// ******* textes
|
||||
|
||||
// - HAUTEUR est_height=* hauteur estimée en intervalle de mètres
|
||||
//"class_hauteur": "est_height",
|
||||
// - VERNACULAIRE : species:FR=*
|
||||
//"vernaculaire": "species:FR",
|
||||
// https://wiki.openstreetmap.org/wiki/Key:circumference
|
||||
"diametre": "circumference",// tour du tronc à hauteur de poitrine
|
||||
// "diametre": {// tour du tronc à hauteur de poitrine
|
||||
// key_converted: "circumference",
|
||||
// conditional_values: {
|
||||
// "0 m": {
|
||||
// ignore_this_data: true,
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
"circonference": "diameter_crown",// tour de toutes les branches, la couronne
|
||||
// "circonference": {// tour de toutes les branches, la couronne
|
||||
// key_converted: "diameter_crown",
|
||||
// conditional_values: {
|
||||
// "0 m": {
|
||||
// ignore_this_data: true,
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// },
|
||||
|
||||
|
||||
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
source: {
|
||||
geojson_path: 'https://opendata.hauts-de-seine.fr/api/explore/v2.1/catalog/datasets/cadastre-vert-les-arbres/exports/geojson?lang=fr&timezone=Europe%2FBerlin',
|
||||
url: 'https://opendata.hauts-de-seine.fr/explore/dataset/cadastre-vert-les-arbres'
|
||||
},
|
||||
filters: {},
|
||||
}
|
||||
export default MappingArbres92
|
103
mappings/converters/configArbresIssy.ts
Normal file
103
mappings/converters/configArbresIssy.ts
Normal file
|
@ -0,0 +1,103 @@
|
|||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingArbresIssy: MappingConfigType = {
|
||||
config_name: 'Mapping des arbres d\'Issy les Moulineaux',
|
||||
config_author: 'tykayn <contact+geojson2osm@cipherbliss.com>',
|
||||
default_properties_of_point: {natural: 'tree'},
|
||||
tags: {
|
||||
// ******* booléens
|
||||
// ******* nombres
|
||||
// - ID_ARBRE : ref:FR:issy_les_mx:id_arbre identifiant interne à Issy les Moulineaux
|
||||
"id_arbre": "ref:FR:issy_les_mx:id_arbre",
|
||||
"ordre": "ref:FR:issy_les_mx:ordre_arbre",
|
||||
// - AN_PLANT : date de plantation
|
||||
"an_plan": "date_start",
|
||||
// ******* textes
|
||||
|
||||
// - HAUTEUR est_height=* hauteur estimée en intervalle de mètres
|
||||
"class_hauteur": "est_height",
|
||||
// - VERNACULAIRE : species:FR=*
|
||||
"vernaculaire": "species:FR",
|
||||
// - GENESPVAR : nom d'espèce species=*
|
||||
"genespvar": "species",
|
||||
// - CADUC_PERS : leaf_cycle=evergreen pour persistant , deciduous pour caduque
|
||||
"caduc_pers": {
|
||||
conditional_values: {
|
||||
"Persistant ": {
|
||||
'tags_to_add':{
|
||||
"leaf_cycle": "evergreen",
|
||||
}
|
||||
},
|
||||
"Caduc ": {
|
||||
'tags_to_add':{
|
||||
"leaf_cycle": "deciduous",
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
// - FEUIL_CONI : feuillu leaf_type=broadleaved / connifère leaf_type=needleleaved
|
||||
"feuil_coni": {
|
||||
conditional_values: {
|
||||
"Feuillu ": {
|
||||
'tags_to_add':{
|
||||
"leaf_type": "broadleaved",
|
||||
}
|
||||
},
|
||||
"Conifère ": {
|
||||
'tags_to_add':{
|
||||
"leaf_type": "needleleaved",
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
// - PARTICULAR : Majeur, Remarquable : historic=monument
|
||||
|
||||
"particular": {
|
||||
conditional_values: {
|
||||
"Majeur ": {
|
||||
'tags_to_add':{
|
||||
"historic": "monument",
|
||||
},
|
||||
},
|
||||
"Remarquable ": {
|
||||
|
||||
'tags_to_add':{
|
||||
"historic": "monument",
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
// - FORME: tree_shape = curtain / free / half_free <= Architecturé, rideau / Libre / Semi-libre
|
||||
"forme": {
|
||||
key_converted: "tree_shape",
|
||||
conditional_values: {
|
||||
"Architecturé, rideau ": {
|
||||
'tags_to_add':{
|
||||
"tree_shape": "curtain",
|
||||
},
|
||||
},
|
||||
"Semi-libre ": {
|
||||
'tags_to_add':{
|
||||
"tree_shape": "half_free",
|
||||
},
|
||||
},
|
||||
"Libre ": {
|
||||
'tags_to_add':{
|
||||
"tree_shape": "free",
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
source: {
|
||||
geojson_path: 'https://data.issy.com/api/explore/v2.1/catalog/datasets/arbres-remarquables-issy-les-moulineaux/exports/geojson?lang=fr&timezone=Europe%2FBerlin',
|
||||
url: 'https://www.data.gouv.fr/fr/datasets/arbres-remarquables'
|
||||
},
|
||||
filters: {
|
||||
offset:10
|
||||
},
|
||||
}
|
||||
export default MappingArbresIssy
|
67
mappings/converters/configAskAngela.ts
Normal file
67
mappings/converters/configAskAngela.ts
Normal file
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* commerces adhérant à Ask Angela
|
||||
* https://wiki.openstreetmap.org/wiki/FR:Tag:harassment_prevention%3Dask_angela
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingAskAngela: MappingConfigType = {
|
||||
config_name: "mappingRouenParkingVelos",
|
||||
config_author: "tykayn <contact@cipherbliss.com>",
|
||||
default_properties_of_point: {
|
||||
'harassment_prevention': 'ask_angela',
|
||||
},
|
||||
source: {
|
||||
geojson_path: '',
|
||||
url: ''
|
||||
},
|
||||
filters: {
|
||||
// exclude_point_if_tag_not_empty: ['id_osm'], // on peut exclure des données converties celles qui sont déjà avec un identifiant openstreetmap afin de favoriser l'intégration san avoir à gérer les doublons
|
||||
// offset: 1
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
boolean_keys: [],
|
||||
tags_to_ignore_if_value_is: ['Non renseigne'],
|
||||
tags: {
|
||||
// ******* opendata de toulouse START **************
|
||||
structure: {
|
||||
remove_original_key: true,
|
||||
conditional_values: {
|
||||
"Hôtel": {
|
||||
tags_to_add: {
|
||||
'tourism': 'hotel'
|
||||
}
|
||||
},
|
||||
"Restaurant": {
|
||||
tags_to_add: {
|
||||
'amenity': 'restaurant'
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
'id': 'ref:FR:Toulouse:ask_angela_id',
|
||||
noms: {
|
||||
key_converted: 'name',
|
||||
convert_to_name: true,
|
||||
},
|
||||
nom : {
|
||||
key_converted: 'name',
|
||||
convert_to_name: true,
|
||||
},
|
||||
// ******* opendata de toulouse END **************
|
||||
// ******* opendata de poitiers START **************
|
||||
'_id': 'ref:FR:Poitiers:ask_angela_id',
|
||||
// ******* opendata de poitiers END **************
|
||||
|
||||
|
||||
// ******* opendata de bordeaux START **************
|
||||
'gid': 'ref:FR:Bordeaux:ask_angela_id',
|
||||
'libelle': 'name',
|
||||
'url': 'contact:website',
|
||||
'cdate': 'start_date:ask_angela',
|
||||
'mdate': 'check_date:ask_angela',
|
||||
// ******* opendata de bordeaux END **************
|
||||
// "addresse": "",
|
||||
}
|
||||
}
|
||||
|
||||
export default MappingAskAngela;
|
154
mappings/converters/configFINESS.ts
Normal file
154
mappings/converters/configFINESS.ts
Normal file
|
@ -0,0 +1,154 @@
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const mappingFINESS: MappingConfigType = {
|
||||
config_name: "mappingFINESS",
|
||||
config_author: "tykayn <contact@cipherbliss.com>",
|
||||
default_properties_of_point: {},
|
||||
source: {
|
||||
geojson_path: "finess/finess_idf.json",
|
||||
url: 'https://www.data.gouv.fr/fr/datasets/r/b9731c6f-c0d7-422e-9e1c-19edd51687ce'
|
||||
},
|
||||
filters: {
|
||||
// exclude_point_if_tag_not_empty: ['id_osm'],
|
||||
// offset: 1
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
boolean_keys: [],
|
||||
tags_to_ignore_if_value_is: [],
|
||||
tags: {
|
||||
// ******* nombres
|
||||
// capacite: 'capacity',
|
||||
// ******* textes
|
||||
siret: 'ref:FR:SIRET',
|
||||
rslongue: {
|
||||
key_converted: 'name',
|
||||
convert_to_name: true,
|
||||
},
|
||||
nofinesset: 'ref:FR:FINESS:et',
|
||||
nofinessej: 'ref:FR:FINESS:ej',
|
||||
codemft: 'ref:FR:code_mft',
|
||||
datemaj_structure: 'date:structure:update',
|
||||
datemaj_geo: 'date:geolocalisation:update',
|
||||
// categetab: 'ref:FR:categtab',
|
||||
epci_code: 'ref:FR:code_EPCI',
|
||||
epci_name: 'ref:FR:EPCI',
|
||||
categagretab: 'ref:FR:FINESS:category_agreg',
|
||||
codeape: 'ref:FR:NAF', // https://wiki.openstreetmap.org/wiki/FR:Key:ref:FR:NAF
|
||||
// categtab: 'type:FR:FINESS',
|
||||
dateouv: 'start_date',
|
||||
dateautor: 'authorisation_date',
|
||||
telephone: {
|
||||
key_converted: 'operator:phone',
|
||||
convert_to_phone: true,
|
||||
},
|
||||
telecopie: {
|
||||
key_converted: 'operator:fax',
|
||||
convert_to_phone: true,
|
||||
},
|
||||
categetab: {
|
||||
remove_original_key: true,
|
||||
key_converted: 'type:FR:FINESS',
|
||||
conditional_values: {
|
||||
// doc https://wiki.openstreetmap.org/wiki/FR:Key:type:FR:FINESS
|
||||
// Centre Hospitalier Régional
|
||||
101: {
|
||||
tags_to_add: {
|
||||
"amenity": "hospital",
|
||||
"emergency": "yes",
|
||||
"healthcare:speciality": "psychiatry",
|
||||
}
|
||||
},
|
||||
// Centre Hospitalier ex Hôpital local
|
||||
106: {
|
||||
tags_to_add: {
|
||||
"amenity": "hospital",
|
||||
"emergency": "yes",
|
||||
"healthcare:speciality": "psychiatry",
|
||||
}
|
||||
},
|
||||
// Soins de Suite et Réadaptation
|
||||
109: {
|
||||
tags_to_add: {
|
||||
"amenity": "hospital",
|
||||
"healthcare:speciality": "psychiatry",
|
||||
}
|
||||
},
|
||||
// Hôpital des armées
|
||||
114: {
|
||||
tags_to_add: {
|
||||
"amenity": "hospital",
|
||||
}
|
||||
},
|
||||
//Établissement de Soins Obstétriques Chirurgico-Gynécologiques
|
||||
122: {
|
||||
tags_to_add: {
|
||||
"amenity": "hospital",
|
||||
"healthcare:speciality": "obstetrics"
|
||||
}
|
||||
},
|
||||
// Centre de Santé
|
||||
124: {
|
||||
tags_to_add: {
|
||||
"healthcare": "center",
|
||||
}
|
||||
},
|
||||
// Centre de Santé Dentaire
|
||||
125: {
|
||||
tags_to_add: {
|
||||
"amenity": "dentist",
|
||||
"healthcare": "dentist",
|
||||
"healthcare:speciality": "dentist",
|
||||
}
|
||||
},
|
||||
|
||||
// Centre Médico-Psychologique (C.M.P.)
|
||||
156: {
|
||||
tags_to_add: {
|
||||
"healthcare": "centre",
|
||||
"healthcare:speciality": "psychiatry"
|
||||
}
|
||||
},
|
||||
// "Laboratoires de Biologie Médicale": {
|
||||
611: {
|
||||
tags_to_add: {
|
||||
"healthcare": "laboratory"
|
||||
}
|
||||
},
|
||||
// Centre d'Accueil Th\u00e9rapeutique \u00e0 temps partiel (C.A.T.T.P.)
|
||||
425: {
|
||||
tags_to_add: {
|
||||
"healthcare": "centre",
|
||||
"healthcare:speciality": "psychiatry"
|
||||
}
|
||||
},
|
||||
// "Centre Hospitalier (C.H.)": {
|
||||
412: {
|
||||
tags_to_add: {
|
||||
"amenity": "hospital",
|
||||
"healthcare": "hospital"
|
||||
}
|
||||
},
|
||||
// "Pharmacie d'Officine": {
|
||||
620: {
|
||||
tags_to_add: {
|
||||
"healthcare": "pharmacy"
|
||||
}
|
||||
},
|
||||
// "Maison de santé (L.6223-3)": {
|
||||
603: {
|
||||
tags_to_add: {
|
||||
"healthcare": "centre"
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default mappingFINESS;
|
175
mappings/converters/configIRVE.ts
Normal file
175
mappings/converters/configIRVE.ts
Normal file
|
@ -0,0 +1,175 @@
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingIRVE: MappingConfigType = {
|
||||
config_name: "IRVE config",
|
||||
config_author: "tykayn <contact@cipherbliss.com>",
|
||||
default_properties_of_point: {
|
||||
'amenity': 'charging_station'
|
||||
},
|
||||
source: {
|
||||
geojson_path: "etalab_data/all.json",
|
||||
url: 'https://www.data.gouv.fr/fr/datasets/r/7eee8f09-5d1b-4f48-a304-5e99e8da1e26'
|
||||
},
|
||||
/**
|
||||
* select only certain points from the source
|
||||
*/
|
||||
filters: {
|
||||
enable_coordinates_filter: false,
|
||||
enable_properties_filter: true,
|
||||
filter_points_lesser_than_NkW: 22 // ne pas sortir les points qui ont moins de ce nombre de puissance nominale
|
||||
// add only geojson points who are found having this regex in the zipcode properties
|
||||
// properties: {
|
||||
// consolidated_code_postal: '^[76|27]'
|
||||
// },
|
||||
// bounding_box: [
|
||||
// {}
|
||||
// ]
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
boolean_keys: [
|
||||
"prise_type_ef",
|
||||
"prise_type_2",
|
||||
"prise_type_combo_ccs",
|
||||
"prise_type_chademo",
|
||||
"gratuit",
|
||||
"paiement_acte",
|
||||
"paiement_cb",
|
||||
"cable_t2_attache"
|
||||
],
|
||||
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: {
|
||||
key_converted: 'operator:phone',
|
||||
convert_to_phone: true, // conversion en format international si possible
|
||||
},
|
||||
phone: {
|
||||
key_converted: 'operator:phone',
|
||||
convert_to_phone: true, // conversion en format international si possible
|
||||
},
|
||||
contact_operateur: 'operator:email', // ici, on souhaite convertir la clé contact_operateur=bidule en email=bidule
|
||||
|
||||
id_station_itinerance: {
|
||||
key_converted: 'ref:EU:EVSE',
|
||||
remove_stars: true,
|
||||
},
|
||||
|
||||
id_station_local: '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.
|
||||
*/
|
||||
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: {
|
||||
convert_to_boolean_value: true, // convertit en yes ou no
|
||||
},
|
||||
// observations: 'note',
|
||||
nom_station: 'description',
|
||||
nom_enseigne: 'network',
|
||||
|
||||
// ******* dates
|
||||
date_mise_en_service: 'start_date',
|
||||
// date_maj: 'source:date',
|
||||
|
||||
|
||||
// ******** champs booléens
|
||||
cable_t2_attache: {
|
||||
key_converted: 'socket:type2_cable',
|
||||
// socket:type2_cable vaut 1 dans OSM si vrai
|
||||
truthy_value: '1',
|
||||
ignore_if_falsy: true,
|
||||
}
|
||||
,
|
||||
prise_type_ef: {
|
||||
key_converted: 'socket:typee',
|
||||
ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
prise_type_2: {
|
||||
key_converted: 'socket:type2',
|
||||
ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
prise_type_combo_ccs: {
|
||||
key_converted: 'socket:type2_combo',
|
||||
ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
prise_type_chademo: {
|
||||
key_converted: 'socket:chademo',
|
||||
ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
// ******** champs plus complexes
|
||||
horaires: 'opening_hours', // déjà au bon format, enfin, en général. vérifier avec le validateur josm.
|
||||
paiement_cb: {
|
||||
key_converted: 'payment:credit_cards',
|
||||
// ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
accessibilite_pmr: {
|
||||
key_converted: "wheelchair",
|
||||
conditional_values: {
|
||||
"Accessibilité inconnue": {
|
||||
ignore_this_data: true, // ne pas ajouter de tag si la valeur est égale à Accessibilité inconnue.
|
||||
},
|
||||
"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"
|
||||
},
|
||||
// On précise que l'on veut conserver cette valeur, par défaut tout ce qui n'est pas précisé en valeur conditionnelle n'est pas conservé
|
||||
"24/7": {
|
||||
value_converted: "24/7"
|
||||
}
|
||||
},
|
||||
},
|
||||
station_deux_roues: {
|
||||
remove_original_key: true,
|
||||
conditional_values: {
|
||||
// ajout de trois tags si la valeur est yes
|
||||
"yes": {
|
||||
tags_to_add: [
|
||||
{bicycle: "yes"},
|
||||
{scooter: "yes"},
|
||||
{motorcar: "no"},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
puissance_nominale: {
|
||||
key_converted: 'charging_station:output',
|
||||
socket_output_find_correspondances: true,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export default MappingIRVE;
|
169
mappings/converters/configIRVESuisse.ts
Normal file
169
mappings/converters/configIRVESuisse.ts
Normal file
|
@ -0,0 +1,169 @@
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingIRVESuisse: MappingConfigType = {
|
||||
config_name: "IRVE config",
|
||||
config_author: "tykayn <contact@cipherbliss.com>",
|
||||
default_properties_of_point: {
|
||||
'amenity': 'charging_station'
|
||||
},
|
||||
source: {
|
||||
geojson_path: "etalab_data/all.json",
|
||||
url: 'https://www.data.gouv.fr/fr/datasets/r/7eee8f09-5d1b-4f48-a304-5e99e8da1e26'
|
||||
},
|
||||
/**
|
||||
* select only certain points from the source
|
||||
*/
|
||||
filters: {
|
||||
enable_coordinates_filter: false,
|
||||
enable_properties_filter: true,
|
||||
// add only geojson points who are found having this regex in the zipcode properties
|
||||
// properties: {
|
||||
// consolidated_code_postal: '^[76|27]'
|
||||
// },
|
||||
// bounding_box: [
|
||||
// {}
|
||||
// ]
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
boolean_keys: [
|
||||
"prise_type_ef",
|
||||
"prise_type_2",
|
||||
"prise_type_combo_ccs",
|
||||
"prise_type_chademo",
|
||||
"gratuit",
|
||||
"paiement_acte",
|
||||
"paiement_cb",
|
||||
"cable_t2_attache"
|
||||
],
|
||||
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: {
|
||||
key_converted: 'operator:phone',
|
||||
convert_to_phone: true, // conversion en format international si possible
|
||||
},
|
||||
phone: {
|
||||
key_converted: 'operator:phone',
|
||||
convert_to_phone: true, // conversion en format international si possible
|
||||
},
|
||||
contact_operateur: 'operator:email', // ici, on souhaite convertir la clé contact_operateur=bidule en email=bidule
|
||||
|
||||
id_station_itinerance: 'ref:EU:EVSE',
|
||||
id_station_local: '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.
|
||||
*/
|
||||
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: {
|
||||
convert_to_boolean_value: true, // convertit en yes ou no
|
||||
},
|
||||
// observations: 'note',
|
||||
nom_station: 'description',
|
||||
nom_enseigne: 'network',
|
||||
|
||||
// ******* dates
|
||||
date_mise_en_service: 'start_date',
|
||||
// date_maj: 'source:date',
|
||||
|
||||
|
||||
// ******** champs booléens
|
||||
cable_t2_attache: {
|
||||
key_converted: 'socket:type2_cable',
|
||||
// socket:type2_cable vaut 1 dans OSM si vrai
|
||||
truthy_value: '1',
|
||||
ignore_if_falsy: true,
|
||||
}
|
||||
,
|
||||
prise_type_ef: {
|
||||
key_converted: 'socket:typee',
|
||||
ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
prise_type_2: {
|
||||
key_converted: 'socket:type2',
|
||||
ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
prise_type_combo_ccs: {
|
||||
key_converted: 'socket:type2_combo',
|
||||
ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
prise_type_chademo: {
|
||||
key_converted: 'socket:chademo',
|
||||
ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
// ******** champs plus complexes
|
||||
horaires: 'opening_hours', // déjà au bon format, enfin, en général. vérifier avec le validateur josm.
|
||||
paiement_cb: {
|
||||
key_converted: 'payment:credit_cards',
|
||||
// ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
accessibilite_pmr: {
|
||||
key_converted: "wheelchair",
|
||||
conditional_values: {
|
||||
"Accessibilité inconnue": {
|
||||
ignore_this_data: true, // ne pas ajouter de tag si la valeur est égale à Accessibilité inconnue.
|
||||
},
|
||||
"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"
|
||||
},
|
||||
// On précise que l'on veut conserver cette valeur, par défaut tout ce qui n'est pas précisé en valeur conditionnelle n'est pas conservé
|
||||
"24/7": {
|
||||
value_converted: "24/7"
|
||||
}
|
||||
},
|
||||
},
|
||||
station_deux_roues: {
|
||||
remove_original_key: true,
|
||||
conditional_values: {
|
||||
// ajout de trois tags si la valeur est yes
|
||||
"yes": {
|
||||
tags_to_add: [
|
||||
{bicycle: "yes"},
|
||||
{scooter: "yes"},
|
||||
{motorcar: "no"},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
puissance_nominale: {
|
||||
key_converted: 'charging_station:output',
|
||||
socket_output_find_correspondances: true,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export default MappingIRVESuisse;
|
44
mappings/converters/configIRVE_osmose.ts
Normal file
44
mappings/converters/configIRVE_osmose.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
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'
|
||||
},
|
||||
source: {
|
||||
geojson_path: "etalab_data/all.json",
|
||||
url: 'https://osmose.openstreetmap.fr/api/0.3/issues.geojson?full=true&status=open&item=8410&limit=20000'
|
||||
},
|
||||
/**
|
||||
* select only certain points from the source
|
||||
*/
|
||||
filters: {
|
||||
enable_coordinates_filter: false,
|
||||
enable_properties_filter: true,
|
||||
},
|
||||
add_not_mapped_tags_too: true,
|
||||
tags: {
|
||||
// // ******* 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',
|
||||
'operator:phone': {
|
||||
key_converted: 'operator:phone',
|
||||
convert_to_phone: true, // conversion en format international si possible
|
||||
},
|
||||
'phone': {
|
||||
key_converted: 'operator:phone',
|
||||
convert_to_phone: true, // conversion en format international si possible
|
||||
},
|
||||
},
|
||||
}
|
||||
export default MappingIRVEOsmose;
|
64
mappings/converters/configIssy_OpenData_2roues.ts
Normal file
64
mappings/converters/configIssy_OpenData_2roues.ts
Normal file
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const mappingIssy2Roues: MappingConfigType = {
|
||||
config_name: "mappingIssy2Roues",
|
||||
config_author: "tykayn <contact@cipherbliss.com>",
|
||||
default_properties_of_point: {
|
||||
'amenity': 'bicycle_parking'
|
||||
},
|
||||
source: {
|
||||
geojson_path: "cyclabilité/issy_les_mx_cyclabilité.json",
|
||||
url: 'https://data.issy.com/explore/dataset/parkings-2-roues/table/?disjunctive.commune=&disjunctive.type_aire=&disjunctive.type_vehicule=&disjunctive.etat=&disjunctive.pres_abri=&disjunctive.acces_reglement=&disjunctive.position=&sort=nb_places'
|
||||
},
|
||||
filters: {
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
boolean_keys: [
|
||||
"acces_reglement",
|
||||
],
|
||||
tags: {
|
||||
// ******* nombres
|
||||
nb_places: 'capacity',
|
||||
nb_pl_velo: 'capacity:bike',
|
||||
nb_pl_moto: 'capacity:motorcycle',
|
||||
annee_crea: 'start_date',
|
||||
// ******* textes
|
||||
type_aire: {
|
||||
"remove_original_key": true,
|
||||
"conditional_values": {
|
||||
"Poteaux": {
|
||||
"tags_to_add": [
|
||||
{
|
||||
"bicycle_parking": "bollard"
|
||||
},
|
||||
]
|
||||
},
|
||||
"Arceaux": {
|
||||
"tags_to_add": [
|
||||
{
|
||||
"bicycle_parking": "bollard"
|
||||
},
|
||||
]
|
||||
},
|
||||
"Anneaux": {
|
||||
"tags_to_add": [
|
||||
{
|
||||
"bicycle_parking": "stands"
|
||||
},
|
||||
]
|
||||
},
|
||||
}
|
||||
},
|
||||
// type_aire: 'nb_pl_moto', // Poteaux => bicycle_parking=bollard, Arceaux, Anneaux => bicycle_parking=stands, Marquage, null, Non renseigné, Range-vélos, Sans, Trottoir
|
||||
id_r2roues: 'ref:FR:r2roues_issy_les_mx',
|
||||
// acces_reglement: 'access',
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default mappingIssy2Roues;
|
28
mappings/converters/configMuseums.ts
Normal file
28
mappings/converters/configMuseums.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingMuseums: MappingConfigType = {
|
||||
config_name: 'Mapping des musées en Île de France',
|
||||
config_author: 'tykayn <contact+geojson2osm@cipherbliss.com>',
|
||||
default_properties_of_point: {tourism: 'museum'},
|
||||
tags: {
|
||||
// ******* booléens
|
||||
// ******* nombres
|
||||
"URL": "contact:website",
|
||||
"Identifiant Muséofile": "ref:FR:museums:museofile",
|
||||
"REF_Deps": "ref:FR:museums:deps",
|
||||
// ******* textes
|
||||
'Téléphone': {
|
||||
key_converted: "contact:phone",
|
||||
convert_to_phone: true,
|
||||
},
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
source: {
|
||||
geojson_path: '',
|
||||
url: ''
|
||||
},
|
||||
filters: {
|
||||
// offset:2 // uncomment to run small tests
|
||||
},
|
||||
}
|
||||
export default MappingMuseums
|
50
mappings/converters/configPlanningFamilial.ts
Normal file
50
mappings/converters/configPlanningFamilial.ts
Normal file
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* commerces adhérant à Ask Angela
|
||||
* https://wiki.openstreetmap.org/wiki/Tag:healthcare:speciality%3Dfamily_planning
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingPlanningFamlial: MappingConfigType = {
|
||||
config_name: "planning familial",
|
||||
config_author: "tykayn <contact@cipherbliss.com>",
|
||||
default_properties_of_point: {
|
||||
'healthcare:speciality': 'family_planning',
|
||||
},
|
||||
source: {
|
||||
// source faite à partir de data scraping du site français
|
||||
geojson_path: '',
|
||||
url: 'https://www.planning-familial.org/fr',
|
||||
overpass_query:`
|
||||
[out:json][timeout:200];
|
||||
{{geocodeArea:"France"}}->.searchArea;
|
||||
nwr["healthcare:speciality"="family_planning"](area.searchArea);
|
||||
out geom;
|
||||
`
|
||||
},
|
||||
filters: {
|
||||
// offset: 1
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
boolean_keys: [],
|
||||
tags_to_ignore_if_value_is: ['Non renseigne'],
|
||||
tags: {
|
||||
adresse: "addr:full",
|
||||
nom : {
|
||||
key_converted: 'name',
|
||||
convert_to_name: true,
|
||||
},
|
||||
telephone : {
|
||||
key_converted: 'contact:phone',
|
||||
convert_to_phone: true,
|
||||
},
|
||||
"contact:website":"contact:website",
|
||||
"family_planning:handles:violences" : "family_planning:handles:violences",
|
||||
"family_planning:handles:sexualities" : "family_planning:handles:sexualities",
|
||||
"family_planning:handles:detection" : "family_planning:handles:detection",
|
||||
"family_planning:handles:abortion" : "family_planning:handles:abortion",
|
||||
"family_planning:handles:contraception" : "family_planning:handles:contraception",
|
||||
// ******* opendata de toulouse END **************
|
||||
}
|
||||
}
|
||||
|
||||
export default MappingPlanningFamlial;
|
88
mappings/converters/configRouen_OpenData_velo_parkings.ts
Normal file
88
mappings/converters/configRouen_OpenData_velo_parkings.ts
Normal file
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const mappingRouenParkingVelos: MappingConfigType = {
|
||||
config_name: "mappingRouenParkingVelos",
|
||||
config_author: "tykayn <contact@cipherbliss.com>",
|
||||
default_properties_of_point: {
|
||||
'amenity': 'bicycle_parking'
|
||||
},
|
||||
source: {
|
||||
geojson_path: "cyclabilité/rouen_parking_velos.json",
|
||||
url: 'https://data.metropole-rouen-normandie.fr/api/explore/v2.1/catalog/datasets/liste-des-stationnements-cyclables-metropole-rouen-normandie/exports/geojson?lang=fr&timezone=Europe%2FBerlin'
|
||||
},
|
||||
filters: {
|
||||
exclude_point_if_tag_not_empty: ['id_osm'], // on peut exclure des données converties celles qui sont déjà avec un identifiant openstreetmap afin de favoriser l'intégration san avoir à gérer les doublons
|
||||
// offset: 100
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
boolean_keys: [
|
||||
"acces_reglement",
|
||||
],
|
||||
tags_to_ignore_if_value_is: ['Non renseigne'],
|
||||
tags: {
|
||||
// ******* nombres
|
||||
capacite: 'capacity',
|
||||
capacite_cargo: 'capacity:cargo_bike',
|
||||
gestionnaire: {
|
||||
key_converted: 'operator',
|
||||
conditional_values: {
|
||||
"Non renseigne": {
|
||||
ignore_this_data: true, // ne pas ajouter de tag si la valeur est égale à
|
||||
}
|
||||
}
|
||||
},
|
||||
proprietaire: {
|
||||
key_converted: 'owner',
|
||||
conditional_values: {
|
||||
"Non renseigne": {
|
||||
ignore_this_data: true, // ne pas ajouter de tag si la valeur est égale à
|
||||
}
|
||||
}
|
||||
},
|
||||
date_maj: 'check_date',
|
||||
// ******* textes
|
||||
commentaire: 'note',
|
||||
surveillance: {
|
||||
key_converted: 'surveillance',
|
||||
ignore_if_falsy: true,
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
mobilier: {
|
||||
key_converted: 'mobilier',
|
||||
remove_original_key: true, // TODO trouver ce qui empêche la conversion quand remove_original_key est a true
|
||||
conditional_values: {
|
||||
"POTELET": {
|
||||
tags_to_add: [
|
||||
{
|
||||
"bicycle_parking": "bollard"
|
||||
},
|
||||
]
|
||||
},
|
||||
"ARCEAU": {
|
||||
tags_to_add: [
|
||||
{
|
||||
"bicycle_parking": "stands"
|
||||
},
|
||||
]
|
||||
},
|
||||
"RATELIER": {
|
||||
tags_to_add: [
|
||||
{
|
||||
"bicycle_parking": "rack"
|
||||
},
|
||||
]
|
||||
},
|
||||
}
|
||||
},
|
||||
id_local: 'ref:FR:rouen_veloparking_id',
|
||||
// acces_reglement: 'access',
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default mappingRouenParkingVelos;
|
59
mappings/converters/configRouen_PAV.ts
Normal file
59
mappings/converters/configRouen_PAV.ts
Normal file
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* points d'apport volontaire de Rouen
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingRouenPAV: MappingConfigType = {
|
||||
config_name: "mappingRouen points d'apport volontaire",
|
||||
config_author: "tykayn <contact@cipherbliss.com>",
|
||||
default_properties_of_point: {
|
||||
'amenity': 'recycling',
|
||||
'recycling_type': 'container',
|
||||
},
|
||||
source: {
|
||||
geojson_path: 'https://data.metropole-rouen-normandie.fr/api/explore/v2.1/catalog/datasets/donmetdec_pav/exports/geojson?lang=fr&timezone=Europe%2FBerlin',
|
||||
url: 'https://data.metropole-rouen-normandie.fr/explore/dataset/donmetdec_pav/information/'
|
||||
},
|
||||
filters: {
|
||||
// exclude_point_if_tag_not_empty: ['id_osm'], // on peut exclure des données converties celles qui sont déjà avec un identifiant openstreetmap afin de favoriser l'intégration san avoir à gérer les doublons
|
||||
// offset: 50
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
boolean_keys: [
|
||||
// "acces_reglement",
|
||||
],
|
||||
tags_to_ignore_if_value_is: ['Non renseigne'],
|
||||
tags: {
|
||||
// ******* nombres
|
||||
pavtyp: {
|
||||
remove_original_key:true,
|
||||
conditional_values: {
|
||||
"Emballages en verre": {
|
||||
tags_to_add: {
|
||||
'recycling:glass': 'yes'
|
||||
}
|
||||
},
|
||||
"Emballages recyclables": {
|
||||
tags_to_add: {
|
||||
'recycling:pmd': 'yes' // https://wiki.openstreetmap.org/wiki/Key:recycling:pmd
|
||||
}
|
||||
},
|
||||
"Ordures ménagères": {
|
||||
tags_to_add: {
|
||||
'amenity': 'waste_disposal'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
date_maj: 'check_date',
|
||||
// ******* textes
|
||||
gml_id: 'ref:FR:Rouen:pav:gml_id',
|
||||
objectid_1: 'ref:FR:Rouen:pav:object',
|
||||
pavid: 'ref:FR:Rouen:pav:id',
|
||||
pavnom: 'ref:FR:Rouen:pav:name',
|
||||
commune: 'ref:FR:Rouen:commune',
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default MappingRouenPAV;
|
32
mappings/converters/configSurveillance.ts
Normal file
32
mappings/converters/configSurveillance.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* caméras référencées sur le site de rouen
|
||||
*
|
||||
* certaines ont une précision "Caméra de sécurité sur borne escamotable"
|
||||
* https://wiki.openstreetmap.org/wiki/Tag:man_made=surveillance
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingSurveillanceRouen: MappingConfigType = {
|
||||
config_name: "caméras de Rouen",
|
||||
config_author: "tykayn <contact@cipherbliss.com>",
|
||||
default_properties_of_point: {
|
||||
'man_made ': 'surveillance',
|
||||
},
|
||||
source: {
|
||||
// source faite à partir de data scraping du site français
|
||||
geojson_path: 'https://umap.openstreetmap.fr/fr/datalayer/44208/f923d80e-2ede-4ab8-b883-a7646491c506/',
|
||||
url: 'https://rouen.fr/videoprotection'
|
||||
},
|
||||
filters: {
|
||||
// exclude_point_if_tag_not_empty: ['id_osm'], // on peut exclure des données converties celles qui sont déjà avec un identifiant openstreetmap afin de favoriser l'intégration san avoir à gérer les doublons
|
||||
// offset: 1
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
boolean_keys: [],
|
||||
tags_to_ignore_if_value_is: ['Non renseigne'],
|
||||
tags: {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
export default MappingSurveillanceRouen;
|
24
mappings/converters/configTest.ts
Normal file
24
mappings/converters/configTest.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingTest: MappingConfigType = {
|
||||
config_name: 'testing config MappingTest',
|
||||
config_author: 'tykayn <contact@cipherbliss.com>',
|
||||
default_properties_of_point: {},
|
||||
tags: {
|
||||
nom_amenageur : 'name'
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
source: {
|
||||
geojson_path: "",
|
||||
url: ""
|
||||
},
|
||||
filters: {},
|
||||
}
|
||||
|
||||
|
||||
export default MappingTest;
|
39
mappings/converters/config_toilettes.ts
Normal file
39
mappings/converters/config_toilettes.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
import MappingConfigType from "../mapping-config.type";
|
||||
|
||||
const MappingToilettes: MappingConfigType = {
|
||||
config_name: "toilettes config for paris sanisettes",
|
||||
config_author: "tykayn <contact@cipherbliss.com>",
|
||||
default_properties_of_point: {
|
||||
'amenity': 'toilets'
|
||||
},
|
||||
source: {
|
||||
geojson_path: "etalab_data/toilettes_paris_datagouv.json",
|
||||
url: 'https://opendata.paris.fr/api/explore/v2.1/catalog/datasets/sanisettesparis/exports/geojson?lang=fr&timezone=Europe%2FBerlin'
|
||||
},
|
||||
/**
|
||||
* select only certain points from the source
|
||||
*/
|
||||
filters: {
|
||||
enable_coordinates_filter: false,
|
||||
enable_properties_filter: false,
|
||||
// add only geojson points who are found having this regex in the zipcode properties
|
||||
properties: {
|
||||
// consolidated_code_postal: '^[75]'
|
||||
}
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
tags: {
|
||||
|
||||
nom_operateur: 'operator',
|
||||
telephone_operateur: 'phone',
|
||||
contact_operateur: 'email', // ici, on souhaite convertir la clé
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
export default MappingToilettes;
|
45
mappings/converters/mappingConfigIRVE_simple.ts
Normal file
45
mappings/converters/mappingConfigIRVE_simple.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
const mappingIRVE:any = {
|
||||
|
||||
// ******* nombres
|
||||
nbre_pdc: 'capacity',
|
||||
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',
|
||||
// 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
|
||||
|
||||
}
|
||||
|
||||
export default mappingIRVE;
|
626
mappings/engine.ts
Normal file
626
mappings/engine.ts
Normal file
|
@ -0,0 +1,626 @@
|
|||
import custom_utils from './utils'
|
||||
import MappingConfigType from "./mapping-config.type";
|
||||
import Formatters from "./formatters";
|
||||
|
||||
const {debugLog} = custom_utils
|
||||
|
||||
let listOfBooleanKeys = [
|
||||
"prise_type_ef",
|
||||
"prise_type_2",
|
||||
"prise_type_combo_ccs",
|
||||
"prise_type_chademo",
|
||||
"gratuit",
|
||||
"paiement_acte",
|
||||
"paiement_cb",
|
||||
"cable_t2_attache"
|
||||
]
|
||||
|
||||
|
||||
function boolToAddable(someBooleanValue: boolean) {
|
||||
return someBooleanValue ? 1 : 0
|
||||
}
|
||||
|
||||
export default class {
|
||||
mapping_config: any = {}
|
||||
public stats: any;
|
||||
truthyValues = [true, 'true', 'True', 'TRUE', '1', 'yes', 1]
|
||||
falsyValues = [false, 'false', 'False', 'FALSE', '0', 'no', 0]
|
||||
private jardinage = false;
|
||||
private current_converted_geojson_point: any;
|
||||
private current_geojson_point: any; // currently converting point
|
||||
private list_of_points: any; // list of geojson points
|
||||
|
||||
constructor(mappingConfig: MappingConfigType) {
|
||||
|
||||
this.setConfig(mappingConfig)
|
||||
this.stats = {
|
||||
filtered_by_excluded_tags: 0,
|
||||
phones_updated: 0,
|
||||
power_output: 0,
|
||||
phones_updated_list: [],
|
||||
phones_not_updated: 0
|
||||
}
|
||||
}
|
||||
|
||||
setConfig(mappingConfig: MappingConfigType) {
|
||||
debugLog('load config', mappingConfig.config_name)
|
||||
debugLog('load config', mappingConfig.config_name)
|
||||
this.mapping_config = mappingConfig
|
||||
}
|
||||
|
||||
getConfig() {
|
||||
return this.mapping_config
|
||||
}
|
||||
|
||||
mapFeaturePoint(featurePointGeoJson: any) {
|
||||
|
||||
let geoJSONConvertedPoint: any = {}
|
||||
|
||||
|
||||
geoJSONConvertedPoint.properties = {...this.mapping_config.default_properties_of_point}
|
||||
geoJSONConvertedPoint.type = featurePointGeoJson.type
|
||||
geoJSONConvertedPoint.geometry = featurePointGeoJson.geometry
|
||||
|
||||
this.current_converted_geojson_point = geoJSONConvertedPoint
|
||||
|
||||
return geoJSONConvertedPoint
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO convert to mapping config property to transform_truthy
|
||||
* @param pointKeyName
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isBooleanKey(pointKeyName: string): boolean {
|
||||
|
||||
return listOfBooleanKeys.indexOf(pointKeyName) !== -1
|
||||
}
|
||||
|
||||
/**
|
||||
* filter: reduce number of features
|
||||
* @param offsetCount
|
||||
* @param listOfFeatures
|
||||
*/
|
||||
filterFeaturesByOffset(offsetCount: number, listOfFeatures: any): Array<any> {
|
||||
let filteredList = listOfFeatures
|
||||
// TODO
|
||||
return filteredList
|
||||
}
|
||||
|
||||
/**
|
||||
* filterFeaturesByPropertyRegex
|
||||
* TODO
|
||||
* @param propertyName
|
||||
* @param criteriaRegex
|
||||
* @param listOfFeatures
|
||||
*/
|
||||
filterFeaturesByPropertyRegex(propertyName: string, criteriaRegex: any, listOfFeatures: any) {
|
||||
let filteredList = listOfFeatures.filter((feature: any) => {
|
||||
return criteriaRegex.test(feature?.properties[propertyName])
|
||||
})
|
||||
return filteredList
|
||||
}
|
||||
|
||||
/**
|
||||
* filter a list of geojson points if one of the given exludedKeys is present in their properties.
|
||||
* Example, we do not want to convert already present OSM point which have an osm_id value in their properties.
|
||||
* @param list
|
||||
* @param excludedKeys
|
||||
*/
|
||||
filterListOfPointsByExcludingIfKeyFilled(list: any, excludedKeys: Array<string>): any[] {
|
||||
let newList: Array<any> = []
|
||||
list.forEach((geojsonPoint: any) => {
|
||||
let pointProperties = Object.keys(geojsonPoint.properties)
|
||||
let addPoint = true;
|
||||
excludedKeys.forEach((key: any) => {
|
||||
debugLog(key, 'pointProperties[key]', pointProperties[key])
|
||||
let foundProperty: string = pointProperties[key]
|
||||
if (foundProperty && foundProperty !== 'null') {
|
||||
addPoint = false
|
||||
}
|
||||
})
|
||||
if (addPoint) {
|
||||
// only add points that pass the not null filter
|
||||
newList.push(geojsonPoint)
|
||||
} else {
|
||||
this.stats.filtered_by_excluded_tags++
|
||||
}
|
||||
})
|
||||
|
||||
return newList;
|
||||
}
|
||||
|
||||
filterListOfPointsByExcludingIfMaxPowerIsLesserThan(minValue: number, list_of_points: any[]): any[] {
|
||||
let newList: any[] = []
|
||||
list_of_points.forEach((geojsonPoint: any) => {
|
||||
let pointProperties = Object.keys(geojsonPoint.properties)
|
||||
// trouver la valeur
|
||||
// socket_output_find_correspondances
|
||||
if (pointProperties.includes('puissance_nominale') &&
|
||||
1 * (geojsonPoint.properties['puissance_nominale'].replace(' kW', '')) > minValue
|
||||
) {
|
||||
newList.push(geojsonPoint)
|
||||
}
|
||||
})
|
||||
|
||||
return newList;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* retuns the converted element from mapping config if present, null otherwise
|
||||
*/
|
||||
mapElementFromConf(featurePoint: any): any {
|
||||
debugLog('mapElementFromConf: mapElementFromConf', featurePoint)
|
||||
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. Your config should be typed to MappingConfigType Type.')
|
||||
}
|
||||
|
||||
debugLog('mapElementFromConf: config_name', this.mapping_config.config_name)
|
||||
let mappingKeys = Object.keys(this.mapping_config.tags)
|
||||
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)
|
||||
// debugLog('featurePointPropertiesKeys', featurePointPropertiesKeys)
|
||||
|
||||
} 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)
|
||||
|
||||
let newProperties = {...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 = {...this.mapping_config.default_properties_of_point}
|
||||
|
||||
// apply new properties if found in mapping config
|
||||
featurePointPropertiesKeys.forEach(pointKeyName => {
|
||||
|
||||
debugLog('mapElementFromConf: convert', pointKeyName)
|
||||
debugLog('mapElementFromConf: mapping keys:', mappingKeys)
|
||||
|
||||
this.convertProperty(pointKeyName, mappingKeys, featurePoint, newProperties)
|
||||
|
||||
|
||||
})
|
||||
|
||||
basePoint.properties = newProperties
|
||||
|
||||
// debugLog('mapElementFromConf: basePoint', basePoint)
|
||||
return basePoint
|
||||
}
|
||||
|
||||
/**
|
||||
* convertit une propriété en une autre selon la config de mapping
|
||||
* @param pointKeyName
|
||||
* @param mappingKeys
|
||||
* @param featurePoint
|
||||
* @param newProperties
|
||||
*/
|
||||
convertProperty(pointKeyName: string, mappingKeys: any, featurePoint: any, newProperties: any) {
|
||||
this.current_geojson_point = featurePoint
|
||||
|
||||
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) {
|
||||
mappingValueObject = this.mapping_config.tags[pointKeyName]
|
||||
debugLog('convertProperty: mappingValueObject ', mappingValueObject)
|
||||
}
|
||||
|
||||
debugLog(' ------ convertProperty: pointKeyName', pointKeyName)
|
||||
// debugLog('convertProperty: mappingKeys', mappingKeys)
|
||||
|
||||
let remove_original_key = false;
|
||||
debugLog('tags_to_ignore_if_value_is', this.mapping_config.tags_to_ignore_if_value_is)
|
||||
if (this.mapping_config.tags_to_ignore_if_value_is && this.mapping_config.tags_to_ignore_if_value_is.length && this.mapping_config.tags_to_ignore_if_value_is?.indexOf(originalValue) !== -1) {
|
||||
debugLog('(x) => ignore', originalValue, ' in ', pointKeyName)
|
||||
remove_original_key = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (this.jardinage) {
|
||||
debugLog(' ------ on fait du jardinage')
|
||||
debugLog(' ------ mode mise en qualité activé')
|
||||
debugLog(' ------ les données en entrée sont des infos geojson extraites depuis overpass turbo.')
|
||||
debugLog(' ------ les clés des objets sont donc déjà dans le format de tag OSM,' +
|
||||
'ne pas les convertir pour les mettre en qualité selon le modèle de mapping.')
|
||||
}
|
||||
if (this.mapping_config.add_not_mapped_tags_too && (mappingKeys.indexOf(pointKeyName) === -1)) {
|
||||
/**
|
||||
* add all unmapped tags is enabled
|
||||
*/
|
||||
debugLog(' ------ add all unmapped tags is enabled')
|
||||
newProperties[pointKeyName] = originalValue;
|
||||
|
||||
} else {
|
||||
/**
|
||||
* only use existing keys
|
||||
*/
|
||||
debugLog("only use existing keys,", pointKeyName)
|
||||
if (mappingKeys.indexOf(pointKeyName) !== -1) {
|
||||
let valueConvertedFromMapping = featurePoint.properties[pointKeyName]
|
||||
let keyConvertedFromMapping = mappingKeys[mappingKeys.indexOf(pointKeyName)]
|
||||
let mappingConfigOfTag = this.mapping_config.tags[pointKeyName]
|
||||
|
||||
debugLog('========== mappingConfigOfTag', mappingConfigOfTag)
|
||||
debugLog('convertProperty: found element', pointKeyName, '=>', keyConvertedFromMapping, 'value : ', valueConvertedFromMapping)
|
||||
let convertedValue = originalValue
|
||||
|
||||
let typeOfConfigForKey = typeof mappingConfigOfTag
|
||||
let isStringValue = typeOfConfigForKey === 'string'
|
||||
let isConfigMappingObject = typeOfConfigForKey === 'object'
|
||||
|
||||
debugLog('convertProperty: - typeofValue', typeOfConfigForKey)
|
||||
debugLog('convertProperty: - pointKeyName', pointKeyName)
|
||||
debugLog('convertProperty: - valueConvertedFromMapping', valueConvertedFromMapping)
|
||||
debugLog('typeof valueConvertedFromMapping === \'string\'', typeOfConfigForKey)
|
||||
|
||||
|
||||
debugLog('convertProperty: isStringValue?', valueConvertedFromMapping, isStringValue)
|
||||
debugLog('convertProperty: isStringValue?', valueConvertedFromMapping, isStringValue)
|
||||
|
||||
debugLog('mappingConfigOfTag', mappingConfigOfTag)
|
||||
debugLog('typeOfConfigForKey', typeOfConfigForKey)
|
||||
|
||||
|
||||
/**
|
||||
* conversion si la clé à une config d'une string, on ne change que la clé, pas la valeur
|
||||
*/
|
||||
if (isStringValue) {
|
||||
debugLog('convertProperty: -- string value')
|
||||
debugLog('convertProperty: -- string value')
|
||||
debugLog('convertProperty: -- simple conversion : ', pointKeyName, '=> ', mappingConfigOfTag, '_', originalValue, '=>', valueConvertedFromMapping)
|
||||
debugLog('convertProperty: -- convertedValue', convertedValue)
|
||||
|
||||
convertedValue = valueConvertedFromMapping
|
||||
|
||||
if (convertedValue) {
|
||||
newProperties[mappingConfigOfTag] = convertedValue
|
||||
}
|
||||
} else {
|
||||
debugLog('convertProperty: no string value')
|
||||
}
|
||||
|
||||
let configObject = mappingConfigOfTag
|
||||
|
||||
if (isConfigMappingObject) {
|
||||
|
||||
|
||||
debugLog('convertProperty: is config object', configObject)
|
||||
let newKey: any = '' + pointKeyName
|
||||
|
||||
|
||||
if (configObject.key_converted) {
|
||||
newKey = configObject.key_converted
|
||||
debugLog('key_converted newKey', newKey)
|
||||
}
|
||||
if (configObject.transform_function) {
|
||||
convertedValue = configObject.transform_function(originalValue)
|
||||
}
|
||||
|
||||
|
||||
if (configObject.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'
|
||||
|
||||
debugLog('truthy_value', originalValue)
|
||||
if (this.truthyValues.indexOf(originalValue) !== -1) {
|
||||
convertedValue = configObject.truthy_value
|
||||
}
|
||||
}
|
||||
if (configObject.falsy_value) {
|
||||
if (this.falsyValues.indexOf(originalValue) !== -1) {
|
||||
convertedValue = configObject.falsy_value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* conversion booléenne
|
||||
*/
|
||||
if (mappingValueObject.convert_to_boolean_value) {
|
||||
debugLog('convertProperty: is boolean_value_conversion')
|
||||
|
||||
convertedValue = this.convertToYesOrNo(originalValue)
|
||||
} else {
|
||||
debugLog('convertProperty: is NOT having boolean_value_conversion', mappingValueObject)
|
||||
}
|
||||
|
||||
|
||||
// gestion des puissances de bornes
|
||||
// avec une fonction de transformation des valeurs
|
||||
// parmi le domaine du jeu de données
|
||||
// nécessite une clé conditionnelle à la valeur true d'autres clés converties.
|
||||
if (configObject.socket_output_find_correspondances) {
|
||||
// trouver à quel socket ça correspond
|
||||
// si y'a plusieurs sockets, utiliser socket:max:output
|
||||
let we_use_max_output = false;
|
||||
let has_prise_type_2: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_2) || false
|
||||
let has_prise_type_combo_ccs: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_combo_ccs) || false
|
||||
let prise_type_chademo: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_chademo) || false
|
||||
let prise_type_ef: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_ef) || false
|
||||
let prise_type_e: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_e) || false
|
||||
let prise_type_autre: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_autre) || false
|
||||
|
||||
let countOfSockets = (boolToAddable(has_prise_type_2) + boolToAddable(has_prise_type_combo_ccs) + boolToAddable(prise_type_chademo) +
|
||||
boolToAddable(prise_type_ef) + boolToAddable(prise_type_autre) + boolToAddable(prise_type_e)
|
||||
);
|
||||
if (countOfSockets > 0) {
|
||||
we_use_max_output = true;
|
||||
}
|
||||
// ajouter les tags de socket newProperties
|
||||
|
||||
let converted_value = originalValue.replace(/[^\d\.\,]/g, '').replace(',', '.')
|
||||
let max_output = 401
|
||||
// do not limit accepted values
|
||||
let out = ''
|
||||
|
||||
if (intOriginalValue < max_output) {
|
||||
|
||||
// rajouter l'unité de puissance kW dans la valeur
|
||||
out = converted_value + ' kW'
|
||||
|
||||
} else {
|
||||
// prise en charge des valeurs en Watts et non en kW.
|
||||
debugLog('too high kW value detected', originalValue)
|
||||
if (intOriginalValue > 1000 && intOriginalValue < 401000) {
|
||||
|
||||
let kilowatts = (parseFloat(converted_value) / 1000).toFixed(2).replace('.00', '');
|
||||
out = ('' + kilowatts + ' kW').replace('.00', '')
|
||||
debugLog('valeurs en Watts out', out, 'original:', originalValue)
|
||||
this.stats.power_output++
|
||||
}
|
||||
}
|
||||
out = (out).replace('.00', '')
|
||||
|
||||
// debug land
|
||||
if (has_prise_type_combo_ccs) {
|
||||
newProperties['socket:type2_combo:output'] = out;
|
||||
this.stats.power_output++
|
||||
}
|
||||
|
||||
if (we_use_max_output) {
|
||||
newProperties['charging_station:output'] = out;
|
||||
} else {
|
||||
if (has_prise_type_2 && prise_type_e) {
|
||||
newProperties['socket:type_2:output'] = out;
|
||||
this.stats.power_output++
|
||||
debugLog('2 prises, attribuer la plus haute valeur à la type 2', out)
|
||||
}
|
||||
|
||||
if (countOfSockets === 1) {
|
||||
|
||||
if (has_prise_type_2) {
|
||||
newProperties['socket:type_2:output'] = out;
|
||||
newProperties['socket:type_2'] = 1;
|
||||
this.stats.power_output++
|
||||
|
||||
}
|
||||
if (has_prise_type_combo_ccs) {
|
||||
newProperties['socket:type2_combo:output'] = out;
|
||||
newProperties['socket:type2_combo'] = 1;
|
||||
this.stats.power_output++
|
||||
|
||||
}
|
||||
if (prise_type_chademo) {
|
||||
newProperties['socket:chademo:output'] = out;
|
||||
newProperties['socket:chademo'] = 1;
|
||||
this.stats.power_output++
|
||||
}
|
||||
if (prise_type_e) {
|
||||
newProperties['socket:typee:output'] = out;
|
||||
newProperties['socket:typee'] = 1;
|
||||
this.stats.power_output++
|
||||
}
|
||||
} else {
|
||||
debugLog('no sockets', this.current_geojson_point.properties.ref)
|
||||
}
|
||||
}
|
||||
return out
|
||||
|
||||
|
||||
}
|
||||
if (configObject.invert_boolean_value) {
|
||||
convertedValue = !this.convertToBoolean(originalValue) ? 'yes' : 'no'
|
||||
debugLog('invert boolean', convertedValue, originalValue)
|
||||
}
|
||||
if (configObject.remove_stars) {
|
||||
convertedValue = originalValue.replace('*', '')
|
||||
debugLog('remove_stars', convertedValue, originalValue)
|
||||
}
|
||||
|
||||
|
||||
if (configObject.convert_to_phone) {
|
||||
convertedValue = Formatters.convertToPhone(originalValue)
|
||||
if (originalValue !== convertedValue) {
|
||||
this.stats.phones_updated++
|
||||
this.stats.phones_updated_list.push(convertedValue)
|
||||
} else {
|
||||
this.stats.phones_not_updated++
|
||||
}
|
||||
debugLog('convertedValue convert_to_phone', originalValue, '=>', convertedValue)
|
||||
|
||||
}
|
||||
if (configObject.convert_to_name) {
|
||||
convertedValue = Formatters.convertToName(originalValue)
|
||||
}
|
||||
if (configObject.remove_original_key) {
|
||||
remove_original_key = true
|
||||
}
|
||||
if (configObject.ignore_if_falsy && this.falsyValues.indexOf(originalValue) !== -1) {
|
||||
remove_original_key = true
|
||||
}
|
||||
if (configObject.ignore_if_truthy && this.truthyValues.indexOf(originalValue) !== -1) {
|
||||
remove_original_key = true
|
||||
}
|
||||
/**
|
||||
* config pour une clé
|
||||
* nous pouvons renseigner une string ou un objet décrivant les transformations à réaliser
|
||||
*/
|
||||
if (configObject.conditional_values) {
|
||||
|
||||
|
||||
// convert numbers from json to string to compare them correctly
|
||||
originalValue = '' + originalValue
|
||||
|
||||
let keysConditionnalValues: any = Object.keys(configObject.conditional_values)
|
||||
let isFoundValue = keysConditionnalValues.indexOf(originalValue)
|
||||
let conditionnalConfig: any = configObject.conditional_values[keysConditionnalValues[isFoundValue]]
|
||||
debugLog('convertProperty: conditional_values__________',
|
||||
configObject.conditional_values)
|
||||
|
||||
debugLog('isFoundValue', isFoundValue, originalValue)
|
||||
debugLog('keysConditionnalValues', keysConditionnalValues)
|
||||
|
||||
debugLog('-----++++++++ originalValue', originalValue)
|
||||
debugLog('----------- isFoundValue', isFoundValue)
|
||||
|
||||
if (!remove_original_key) {
|
||||
|
||||
|
||||
if (isFoundValue !== -1) {
|
||||
debugLog('found condition', isFoundValue)
|
||||
|
||||
/** ----------------------
|
||||
* gestion des valeurs conditionnelles
|
||||
* ---------------------- */
|
||||
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;
|
||||
}
|
||||
|
||||
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(originalValue) !== -1) {
|
||||
convertedValue = conditionnalConfig.truthy_value
|
||||
}
|
||||
}
|
||||
if (conditionnalConfig.falsy_value) {
|
||||
if (this.falsyValues.indexOf(originalValue) !== -1) {
|
||||
convertedValue = conditionnalConfig.falsy_value
|
||||
}
|
||||
}
|
||||
|
||||
// use the value converted
|
||||
else if (conditionnalConfig.value_converted) {
|
||||
convertedValue = conditionnalConfig.value_converted
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (conditionnalConfig?.tags_to_add) {
|
||||
debugLog('on ajoute des tags', conditionnalConfig.tags_to_add)
|
||||
// on peut définir un ensemble de tags à rajouter
|
||||
let tagKeys = Object.keys(conditionnalConfig.tags_to_add)
|
||||
debugLog('conditionnalConfig.tags_to_add', conditionnalConfig.tags_to_add)
|
||||
tagKeys.forEach((index: any) => {
|
||||
debugLog('key', index)
|
||||
debugLog('value', conditionnalConfig.tags_to_add[index])
|
||||
newProperties[index] = conditionnalConfig.tags_to_add[index]
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
debugLog('convertProperty: convertedValue ==========> {', newKey, ':', convertedValue, '}')
|
||||
debugLog(' =============== remove_original_key', newKey, remove_original_key)
|
||||
|
||||
let keysOfConfigObject = [];
|
||||
let hasKeyIgnoreThisData = false;
|
||||
if (configObject) {
|
||||
keysOfConfigObject = Object.keys(configObject)
|
||||
debugLog('keysOfConfigObject', keysOfConfigObject)
|
||||
hasKeyIgnoreThisData = (keysOfConfigObject.indexOf('ignore_this_data') !== -1)
|
||||
}
|
||||
|
||||
debugLog('remove_original_key && newKey && convertedValue && hasKeyIgnoreThisData', remove_original_key, newKey, convertedValue, hasKeyIgnoreThisData)
|
||||
if (!remove_original_key && newKey && convertedValue && !hasKeyIgnoreThisData
|
||||
) {
|
||||
debugLog('convertedValue', convertedValue)
|
||||
|
||||
debugLog('convertProperty: added', newKey, (`${convertedValue}`).trim())
|
||||
newProperties[newKey] = (`${convertedValue}`).trim()
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
debugLog('!!!!!! property not found in mappingKeys: ', pointKeyName)
|
||||
}
|
||||
}
|
||||
|
||||
debugLog('newProperties', newProperties)
|
||||
|
||||
return newProperties;
|
||||
}
|
||||
|
||||
private isTruthyValue(someValue: string) {
|
||||
let convertedValue;
|
||||
if (this.truthyValues.indexOf(someValue) !== -1) {
|
||||
convertedValue = true
|
||||
}
|
||||
if (this.falsyValues.indexOf(someValue) !== -1) {
|
||||
convertedValue = false
|
||||
}
|
||||
return convertedValue
|
||||
}
|
||||
|
||||
private convertToYesOrNo(originalValue: any) {
|
||||
debugLog('convertProperty: ==========> original value', originalValue)
|
||||
let convertedValue = '';
|
||||
if (this.truthyValues.indexOf(originalValue) !== -1) {
|
||||
convertedValue = 'yes'
|
||||
} else {
|
||||
debugLog('convertProperty: ==========> !!! NOT in truthy values', originalValue)
|
||||
}
|
||||
if (this.falsyValues.indexOf(originalValue) !== -1) {
|
||||
convertedValue = 'no'
|
||||
} else {
|
||||
debugLog('convertProperty: ==========> !!! NOT in falsy values', originalValue)
|
||||
}
|
||||
return convertedValue;
|
||||
}
|
||||
|
||||
private convertToBoolean(originalValue: any) {
|
||||
debugLog('convertProperty: ==========> original value', originalValue)
|
||||
let convertedValue;
|
||||
if (this.truthyValues.indexOf(originalValue) !== -1) {
|
||||
convertedValue = true
|
||||
} else {
|
||||
debugLog('convertProperty: ==========> !!! NOT in truthy values', originalValue)
|
||||
}
|
||||
if (this.falsyValues.indexOf(originalValue) !== -1) {
|
||||
convertedValue = false
|
||||
} else {
|
||||
debugLog('convertProperty: ==========> !!! NOT in falsy values', originalValue)
|
||||
}
|
||||
return convertedValue;
|
||||
}
|
||||
|
||||
}
|
13
mappings/extractors/askangela.sh
Normal file
13
mappings/extractors/askangela.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des points
|
||||
# "harassment_prevention=ask_angela"
|
||||
# pour le monde entier
|
||||
|
||||
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:25];nwr["harassment_prevention"="ask_angela"];out+meta;'
|
||||
|
||||
export_file="ask_angela_points_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
11
mappings/extractors/cargo_bike_france.sh
Normal file
11
mappings/extractors/cargo_bike_france.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des parking à vélo cargo
|
||||
# cargo_bike=*
|
||||
# en France
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;nwr["cargo_bike"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="cargo_bike_zone_france_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
13
mappings/extractors/centrales_france.sh
Normal file
13
mappings/extractors/centrales_france.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des points
|
||||
# tout système produisant de l'énergie, pas seulement élec.
|
||||
# pour le monde entier
|
||||
|
||||
echo -e "\n récupération de données depuis OpenStreetMap \n"
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;node["power"="generator"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="centrales_zone_france_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
11
mappings/extractors/coworking_france.sh
Normal file
11
mappings/extractors/coworking_france.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des points
|
||||
# des espaces de coworking
|
||||
# en France
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;node["amenity"="coworking_space"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="coworking_zone_france_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
60
mappings/extractors/geojson_to_csv.py
Normal file
60
mappings/extractors/geojson_to_csv.py
Normal file
|
@ -0,0 +1,60 @@
|
|||
import argparse
|
||||
import json
|
||||
import pandas as pd
|
||||
|
||||
# définir le parseur d'arguments
|
||||
parser = argparse.ArgumentParser(description="Convertir un fichier GeoJSON en CSV et ajouter des colonnes latitude et longitude")
|
||||
parser.add_argument("geojson", help="Le chemin du fichier GeoJSON à convertir")
|
||||
parser.add_argument("-o", "--output", default=None, help="Le nom du fichier de sortie CSV (par défaut: le même nom que le fichier GeoJSON avec l'extension CSV)")
|
||||
args = parser.parse_args()
|
||||
|
||||
# charger le fichier GeoJSON en tant que liste de features
|
||||
with open(args.geojson, "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
# afficher le décompte des éléments
|
||||
print("Nombre d'éléments dans le fichier GeoJSON :", len(data["features"]))
|
||||
|
||||
# initialiser un ensemble pour stocker les clés de toutes les features
|
||||
all_keys = set()
|
||||
|
||||
# parcourir chaque feature pour trouver les clés de tag
|
||||
for feature in data["features"]:
|
||||
# ajouter les clés de la feature à l'ensemble
|
||||
all_keys.update(feature["properties"]["tags"].keys())
|
||||
|
||||
# convertir l'ensemble en liste et trier les clés
|
||||
columns = sorted(list(all_keys))
|
||||
|
||||
# initialiser le dataframe avec les colonnes définies ci-dessus
|
||||
df = pd.DataFrame(columns=["id", "latitude", "longitude"] + columns)
|
||||
|
||||
# parcourir chaque feature pour ajouter une nouvelle ligne au dataframe avec les valeurs de chaque tag
|
||||
for feature in data["features"]:
|
||||
# définir la latitude et la longitude selon la première coordonnée si la géométrie est de type Linestring
|
||||
if feature["geometry"]["type"] == "LineString":
|
||||
latitude = feature["geometry"]["coordinates"][0][1]
|
||||
longitude = feature["geometry"]["coordinates"][0][0]
|
||||
else:
|
||||
latitude = feature["geometry"]["coordinates"][1]
|
||||
longitude = feature["geometry"]["coordinates"][0]
|
||||
|
||||
row = {
|
||||
"id": feature["properties"]["id"],
|
||||
"latitude": latitude,
|
||||
"longitude": longitude
|
||||
}
|
||||
# ajouter les valeurs de chaque tag à la ligne
|
||||
for key in columns:
|
||||
row[key] = feature["properties"]["tags"].get(key, "")
|
||||
df = df._append(row, ignore_index=True)
|
||||
|
||||
# définir le nom du fichier de sortie CSV
|
||||
if args.output:
|
||||
output_file = args.output
|
||||
else:
|
||||
output_file = os.path.splitext(args.geojson)[0] + ".csv"
|
||||
|
||||
print('fichier csv converti : ', output_file)
|
||||
# convertir le dataframe en CSV en incluant toutes les colonnes
|
||||
df.to_csv(output_file, sep=";", index=False)
|
13
mappings/extractors/hackerspace_france.sh
Normal file
13
mappings/extractors/hackerspace_france.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des points
|
||||
# leisure=hackerspace
|
||||
# en France
|
||||
|
||||
echo -e "\n récupération de données depuis OpenStreetMap \n"
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;nwr["leisure"="hackerspace"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="hackerspace_zone_france_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
10
mappings/extractors/hospitals_france.sh
Normal file
10
mappings/extractors/hospitals_france.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des hopitaux
|
||||
# en France
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;nwr["amenity"="hospital"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="hospitals_zone_france_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
11
mappings/extractors/irve_france.sh
Normal file
11
mappings/extractors/irve_france.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des stations et bornes de recharges
|
||||
# "amenity"="charging_station"
|
||||
# en France
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;nwr["amenity"="charging_station"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="irve_zone_france_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
13
mappings/extractors/irve_rouen.sh
Normal file
13
mappings/extractors/irve_rouen.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des points d'apport volontaire
|
||||
# amenity=recycling
|
||||
# à Rouen
|
||||
|
||||
echo -e "\n récupération de données depuis OpenStreetMap \n"
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3600075628)->.searchArea;nwr["amenity"="charging_station"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="irve_zone_rouen_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
10
mappings/extractors/mairies.sh
Normal file
10
mappings/extractors/mairies.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des mairies
|
||||
# en France
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;nwr["amenity"="townhall"](area.searchArea);out+meta;'
|
||||
|
||||
export_file="mairies_points_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
12
mappings/extractors/museums_france.sh
Normal file
12
mappings/extractors/museums_france.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des musées en France
|
||||
|
||||
echo -e "\n récupération de données depuis OpenStreetMap \n"
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;node["tourism"="museum"](area.searchArea);out+geom;'
|
||||
|
||||
|
||||
export_file="museum_zone_france_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
13
mappings/extractors/pav_france.sh
Normal file
13
mappings/extractors/pav_france.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des points d'apport volontaire
|
||||
# amenity=recycling
|
||||
# en France
|
||||
|
||||
echo -e "\n récupération de données depuis OpenStreetMap \n"
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;nwr["amenity"="recycling"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="pav_zone_france_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
13
mappings/extractors/pav_rouen.sh
Normal file
13
mappings/extractors/pav_rouen.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des points d'apport volontaire
|
||||
# amenity=recycling
|
||||
# à Rouen
|
||||
|
||||
echo -e "\n récupération de données depuis OpenStreetMap \n"
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3600075628)->.searchArea;nwr["amenity"="recycling"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="pav_zone_rouen_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
14
mappings/extractors/planning_familiaux.sh
Normal file
14
mappings/extractors/planning_familiaux.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des points de planning familial du monde entier
|
||||
# pour le monde entier
|
||||
|
||||
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:25];nwr["healthcare:speciality"="family_planning"];out+meta;'
|
||||
|
||||
export_file="planning_familial_points_from_openstreetmap"
|
||||
|
||||
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
12
mappings/extractors/ponts.sh
Normal file
12
mappings/extractors/ponts.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des ponts qui ont un nom
|
||||
# pour le monde entier
|
||||
|
||||
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;nwr["bridge"]["name"](area.searchArea);out+meta;'
|
||||
|
||||
export_file="ponts_points_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
12
mappings/extractors/restaurant_france.sh
Normal file
12
mappings/extractors/restaurant_france.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des restaurants
|
||||
# "amenity"="restaurant" en France
|
||||
|
||||
echo -e "\n récupération de données depuis OpenStreetMap \n"
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;nwr["amenity"="restaurant"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="restaurant_zone_france_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
12
mappings/extractors/surveillance_france.sh
Normal file
12
mappings/extractors/surveillance_france.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des caméras de surveillance
|
||||
# "man_made"="surveillance"
|
||||
# en France
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=%5Bout%3Ajson%5D%5Btimeout%3A300%5D%3B%0Aarea(id%3A3602202162)-%3E.searchArea%3B%0Anode%5B%22man_made%22%3D%22surveillance%22%5D(area.searchArea)%3B%0Aout+geom%3B'
|
||||
|
||||
export_file="surveillance_zone_france_from_openstreetmap"
|
||||
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
13
mappings/extractors/toilets_france.sh
Normal file
13
mappings/extractors/toilets_france.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# export depuis OSM des points
|
||||
# "amenity"="toilets"
|
||||
# en France
|
||||
|
||||
echo -e "\n récupération de données depuis OpenStreetMap \n"
|
||||
|
||||
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:300];area(id:3602202162)->.searchArea;nwr["amenity"="toilets"](area.searchArea);out+geom;'
|
||||
|
||||
export_file="toilets_zone_france_from_openstreetmap"
|
||||
source $www_folder/mapping-osm-geojson/update_scripts/functions.sh
|
||||
extract_from_osm $url $export_file
|
86
mappings/formatters.ts
Normal file
86
mappings/formatters.ts
Normal file
|
@ -0,0 +1,86 @@
|
|||
import custom_utils from "./utils";
|
||||
|
||||
const {debugLog,prefix_phone_fr_only} = custom_utils
|
||||
|
||||
/**
|
||||
* Class that helps to convert values into predefined formats
|
||||
*/
|
||||
export default class Formatters {
|
||||
|
||||
static convertToPhone(originalValue: string) :string{
|
||||
/**
|
||||
* nettoyer les numéros de téléphone en ne gardant que les nombres et le préfixe de pays
|
||||
*/
|
||||
debugLog("convertToPhone:" , originalValue);
|
||||
// debugLog('originalValue', originalValue.substring(1))
|
||||
if (!originalValue) {
|
||||
originalValue = ''
|
||||
}
|
||||
let original_without_spaces = originalValue.replace(' ', '')
|
||||
let cleaned_value = `${original_without_spaces}`
|
||||
cleaned_value = cleaned_value
|
||||
.trim()
|
||||
.replace('Stations-e', '')
|
||||
.replace(/[a-zA-Zéèà]/ig, '')
|
||||
.replace(/[\(\)\.\- ]/g, '')
|
||||
let add_prefix = false;
|
||||
if (
|
||||
/^\d/.test(cleaned_value) &&
|
||||
!/^\+33 /.test(original_without_spaces)
|
||||
) {
|
||||
add_prefix = true
|
||||
}
|
||||
cleaned_value = cleaned_value.replace('+33', '')
|
||||
|
||||
debugLog("convertToPhone: cleaned_value" , cleaned_value);
|
||||
|
||||
if (/^0/.test(cleaned_value)) {
|
||||
cleaned_value = cleaned_value.substring(1)
|
||||
}
|
||||
let array_of_numbers = cleaned_value
|
||||
.split('')
|
||||
|
||||
|
||||
let ii = 0;
|
||||
if (cleaned_value.length == 4) {
|
||||
ii = 1
|
||||
}
|
||||
let convertedValue = ''
|
||||
array_of_numbers.forEach((num: string) => {
|
||||
if (ii % 2) {
|
||||
convertedValue += ' ';
|
||||
}
|
||||
convertedValue += num;
|
||||
ii++;
|
||||
})
|
||||
|
||||
|
||||
convertedValue = convertedValue.replace(' ', ' ').trim();
|
||||
debugLog('convertedValue', convertedValue)
|
||||
if (
|
||||
/^\d/.test(convertedValue) &&
|
||||
!/^\+33 /.test(convertedValue)
|
||||
) {
|
||||
add_prefix = true
|
||||
}
|
||||
if (add_prefix && prefix_phone_fr_only) {
|
||||
convertedValue = `+33 ` + convertedValue
|
||||
}
|
||||
|
||||
debugLog('phone: ', originalValue, '=>', convertedValue)
|
||||
|
||||
|
||||
return ""+convertedValue;
|
||||
}
|
||||
|
||||
static convertToName(originalValue: string) {
|
||||
|
||||
if (originalValue && originalValue.length) {
|
||||
|
||||
let tab = originalValue.toLowerCase().split('')
|
||||
tab[0] = originalValue[0].toUpperCase()
|
||||
return tab.join('');
|
||||
}
|
||||
return ''
|
||||
}
|
||||
}
|
106
mappings/mapping-config.type.ts
Normal file
106
mappings/mapping-config.type.ts
Normal file
|
@ -0,0 +1,106 @@
|
|||
interface GeoJsonGeometry {
|
||||
type: string,
|
||||
coordinates: Array<number>,
|
||||
}
|
||||
|
||||
interface GeoJsonProperties {
|
||||
[key: string]: any,
|
||||
}
|
||||
|
||||
interface GeoJsonFeature {
|
||||
type: string,
|
||||
geometry: GeoJsonGeometry,
|
||||
properties: GeoJsonProperties,
|
||||
}
|
||||
|
||||
export interface FeatureCollection {
|
||||
type: string,
|
||||
features: Array<GeoJsonFeature>,
|
||||
}
|
||||
|
||||
export interface BoundingBoxCoordinatesType {
|
||||
xMin: number,
|
||||
xMax: number,
|
||||
yMin: number,
|
||||
yMax: number,
|
||||
}
|
||||
|
||||
/**
|
||||
* configuration to choose what point to exclude or include from geographic or properties hints
|
||||
*/
|
||||
export interface filteringConfig {
|
||||
enable_coordinates_filter?: boolean;
|
||||
enable_properties_filter?: boolean;
|
||||
properties?: object;
|
||||
bounding_box?: object;
|
||||
offset?: number;
|
||||
filter_points_lesser_than_NkW?: number; // filtrer les points qui ont moins de N kW dans la clé de puissance max
|
||||
exclude_point_if_tag_not_empty?: Array<string>;
|
||||
exclude_point_if_tag_truthy?: Array<string>;
|
||||
exclude_point_if_tag_falsy?: Array<string>;
|
||||
}
|
||||
|
||||
interface sourceConfig {
|
||||
geojson_path: string; // the relative path to the geojson source file to analyse, from the root of this repository
|
||||
url: string; // URL from where the geojson comes online, on a data platform. This URL should be fetchable to get the most recent data of the concerned dataset to convert.
|
||||
overpass_query?: string; // query to get objects from OSM
|
||||
}
|
||||
|
||||
export default interface MappingConfigType {
|
||||
config_name: string, // descriptive name
|
||||
config_author: string, // name and email for example
|
||||
osmose?: boolean, // is the data from Osmose export
|
||||
boolean_keys?: Array<string>, // what keys should be converted to boolean values
|
||||
tags_to_ignore_if_value_is?: Array<string>, // list of strings for which we ignore the tags if they equal any of these
|
||||
add_not_mapped_tags_too: boolean, // by default, we do not add tags from properties that we do not specify, set this to true to change it
|
||||
default_properties_of_point?: object, // tag to add to every converted point by default
|
||||
source: sourceConfig,
|
||||
filters?: filteringConfig,
|
||||
tags: FeaturePropertyMappingConfigType
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* configuration concernant toutes les valeurs
|
||||
*/
|
||||
export interface FeaturePropertyMappingConfigType {
|
||||
convert_to_boolean_value?: boolean,
|
||||
invert_boolean_value?: boolean,
|
||||
remove_original_key?: boolean,
|
||||
convert_to_phone?: boolean,
|
||||
convert_to_name?: boolean,
|
||||
ignore_if_falsy?: boolean,
|
||||
ignore_if_truthy?: boolean,
|
||||
remove_stars?: boolean,
|
||||
conditional_values?: ConditionnalValuesConfigType,
|
||||
transform_function?: Function,
|
||||
|
||||
[key: string]: any,
|
||||
}
|
||||
|
||||
/**
|
||||
* choix de conversion de la valeur originale selon des critères donnés
|
||||
*/
|
||||
export interface ConditionnalValuesConfigType {
|
||||
key_converted?: string,
|
||||
value_converted?: string,
|
||||
truthy_value?: any,
|
||||
falsy_value?: any, // si la valeur originale est falsy, la convertir en la valeur donnée ici
|
||||
ignore_this_data?: boolean,
|
||||
tags_to_add?: TagsToAddConfig,
|
||||
transform_function?: Function,
|
||||
}
|
||||
|
||||
export interface ConditionnalValuesType {
|
||||
[key: string]: ConditionnalValuesConfigType,
|
||||
}
|
||||
|
||||
interface OneOSMTag {
|
||||
[key: string]: string,
|
||||
}
|
||||
|
||||
export interface TagsToAddConfig {
|
||||
tags_to_add: Array<OneOSMTag>
|
||||
}
|
||||
|
||||
|
78
mappings/utils.ts
Normal file
78
mappings/utils.ts
Normal file
|
@ -0,0 +1,78 @@
|
|||
import * as fs from 'node:fs'
|
||||
|
||||
let show_debug = 0
|
||||
// show_debug = 1
|
||||
let output_folder = 'output';
|
||||
const prefix_phone_fr_only = true
|
||||
|
||||
// console.log('----------------------show_debug', show_debug)
|
||||
|
||||
/**
|
||||
* wrapper de log qui se montre uniquemnt si show_debug a été activé
|
||||
* @param args
|
||||
*/
|
||||
function debugLog(...args: any[]) {
|
||||
if (show_debug) {
|
||||
console.log('### debug: ',)
|
||||
args.map((elem: any) => console.log(' ', elem))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let 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: string): boolean {
|
||||
|
||||
return listOfBooleanKeys.indexOf(pointKeyName) !== -1
|
||||
}
|
||||
|
||||
/**
|
||||
* crée un fichier dans le dossier par défaut, output
|
||||
* @param fileName
|
||||
* @param fileContent
|
||||
*/
|
||||
function writeFile(fileName: string, fileContent: any, outputPathOverride: string = '') {
|
||||
|
||||
if (outputPathOverride) {
|
||||
output_folder = outputPathOverride
|
||||
} else {
|
||||
console.log('pas de output', outputPathOverride
|
||||
)
|
||||
}
|
||||
let destination = `./${output_folder}/${fileName}`.replace('//', '/');
|
||||
console.log('write file ', destination)
|
||||
return fs.writeFile(
|
||||
destination,
|
||||
fileContent,
|
||||
'utf8',
|
||||
(err) => {
|
||||
if (err) {
|
||||
console.log(`Error writing file: ${err}`)
|
||||
} else {
|
||||
console.log(`File ${fileName} is written successfully!`)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
export default {
|
||||
debugLog,
|
||||
isBooleanKey,
|
||||
writeFile,
|
||||
prefix_phone_fr_only
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue