From 124a9b8fe86899aad4a18e7eb00c1867d18a7450 Mon Sep 17 00:00:00 2001 From: Olyon Date: Sun, 1 Sep 2019 00:32:48 +0200 Subject: [PATCH 1/5] Add files via upload --- analysers/analyser_merge_radio_support_FR.py | 136 +++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 analysers/analyser_merge_radio_support_FR.py diff --git a/analysers/analyser_merge_radio_support_FR.py b/analysers/analyser_merge_radio_support_FR.py new file mode 100644 index 000000000..f910abe8b --- /dev/null +++ b/analysers/analyser_merge_radio_support_FR.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +#-*- coding: utf-8 -*- + +from .Analyser_Merge_Dynamic import Analyser_Merge_Dynamic, SubAnalyser_Merge_Dynamic +from .Analyser_Merge import Source, CSV, Load, Mapping, Select, Generate +import json + +class Analyser_Merge_Radio_Support_FR(Analyser_Merge_Dynamic): + + def __init__(self, config, logger = None): + Analyser_Merge_Dynamic.__init__(self, config, logger) + + mapingfile = json.loads(open("merge_data/radio_support_FR.mapping.json").read()) + for r in mapingfile: + self.classFactory(SubAnalyser_Merge_Radio_Support_FR, r['NAT_ID'], r['NAT_ID'], r['title'], r['tags_select'], r['tags_generate1'], r['tags_generate2']) + + +class SubAnalyser_Merge_Radio_Support_FR(SubAnalyser_Merge_Dynamic): + def __init__(self, config, error_file, logger, NAT_ID, title, tags_select, tags_generate1, tags_generate2): + + self.missing_official = {"item":"10000", "class": 1+10*NAT_ID, "level": 3, "tag": ["merge"], "desc": T_f(u"Radio support ({0}) not integrated", title) } + self.possible_merge = {"item":"10001", "class": 3+10*NAT_ID, "level": 3, "tag": ["merge"], "desc": T_f(u"Radio support ({0}), integration suggestion", title) } + self.update_official = {"item":"10002", "class": 4+10*NAT_ID, "level": 3, "tag": ["merge"], "desc": T_f(u"Radio support ({0}) update", title) } + + self.communeNameIndexedByInsee = {} + with open("dictionaries/FR/BddCommunes", "r") as f : + for x in f : + x = x.split("\t") + code_insee = x[0] + name_insee = x[1].strip().decode('utf-8') + self.communeNameIndexedByInsee[code_insee] = name_insee + + SubAnalyser_Merge_Dynamic.__init__(self, config, error_file, logger, + u"https://www.data.gouv.fr/fr/datasets/donnees-sur-les-installations-radioelectriques-de-plus-de-5-watts-1/", + u"Données sur les installations radioélectriques de plus de 5 watts", + CSV(Source(attribution = u"data.gouv.fr:ANFR", millesime = "08/2019", + fileUrl = u"https://www.data.gouv.fr/fr/datasets/r/b947376a-68a9-49a0-adf2-0899b35fffd9", zip = "SUP_SUPPORT.txt", encoding = "ISO-8859-15"), + separator = u";", quote = u'$'), + Load( +("CASE \"COR_CD_EW_LON\" WHEN 'W' THEN -1*(to_number(\"COR_NB_DG_LON\", '99') + to_number(\"COR_NB_MN_LON\", '99') / 60 + to_number(\"COR_NB_SC_LON\", '99') / 3600) WHEN 'E' THEN to_number(\"COR_NB_DG_LON\", '99') + to_number(\"COR_NB_MN_LON\", '99') / 60 + to_number(\"COR_NB_SC_LON\", '99') / 3600 END",), +("CASE \"COR_CD_NS_LAT\" WHEN 'S' THEN -1*(to_number(\"COR_NB_DG_LAT\", '99') + to_number(\"COR_NB_MN_LAT\", '99') / 60 + to_number(\"COR_NB_SC_LAT\", '99') / 3600) WHEN 'N' THEN to_number(\"COR_NB_DG_LAT\", '99') + to_number(\"COR_NB_MN_LAT\", '99') / 60 + to_number(\"COR_NB_SC_LAT\", '99') / 3600 END",), + select = {"NAT_ID": str(NAT_ID)}, + uniq = ("SUP_ID",) + ), + Mapping( + select = Select( + types = ["nodes", "ways"], + tags = tags_select), + conflationDistance = 50, + osmRef = "ref:FR:ANFR", + generate = Generate( + static1 = tags_generate1, + static2 = dict({"source": self.source}, **tags_generate2), + mapping1 = { + "ref:FR:ANFR": "SUP_ID", + "owner": lambda fields: self.proprietaire[int(fields["TPO_ID"])] if fields["TPO_ID"] and int(fields["TPO_ID"]) in self.proprietaire else None, + "height": lambda fields: fields["SUP_NM_HAUT"].replace(",", ".") if fields["SUP_NM_HAUT"] else None + }, + mapping2 = { + }, + text = lambda tags, fields: {"en": u"%s, address : %s, %s" % (title, + ", ".join(filter(lambda x: x != "None", [fields["ADR_LB_LIEU"], fields["ADR_LB_ADD1"], fields["ADR_LB_ADD2"], fields["ADR_LB_ADD3"],fields["ADR_NM_CP"]])), + (lambda x: self.communeNameIndexedByInsee[x] if x in self.communeNameIndexedByInsee else x)(fields["COM_CD_INSEE"])) + }))) + + # nombre : colonne TPO_ID dans SUP_SUPPORT.txt et valeur : SUP_PROPRIETAIRE.txt + proprietaire = {1 : u"ANFR", + #2 : Association, + #3 : Aviation Civile, + 4 : u"Bouygues", + #5 : CCI,Ch Metiers,Port Aut,Aérop, + #6 : Conseil Départemental, + #7 : Conseil Régional, + #8 : Coopérative Agricole, Vinicole, + #9 : Copropriété, Syndic, SCI, + 10 : u"CROSS", + #11 : DDE, + #12 : Autres + #13 : EDF ou GDF, + #14 : Etablissement de soins, + #15 : Etat, Ministère, + 16 : u"Orange Services Fixes", + #17 : Syndicat des eaux, Adduction, + #18 : Intérieur, + 19 : u"La Poste", + #20 : Météo, + 21 : u"Orange", + #22 : Particulier, + #23 : Phares et balises, + 24 : u"SNCF Réseau", + 25 : u"RTE", + #26 : SDIS, secours, incendie, + 27 : u"SFR", + #28 : Société HLM, + #29 : Société Privée SA, + #30 : Sociétés d'Autoroutes, + 31 : "Société réunionnaise du radiotéléphone", + 32 : u"TDF", + 33 : u"Towercast", + #34 : Commune, communauté de commune, + 35 : u"Voies navigables de France", + 36 : u"Altitude Telecom", + 37 : u"Antalis", + 38 : u"One Cast", + 39 : u"Gendarmerie nationale", + 40 : u"Tikiphone", + 41 : u"France Caraibes Mobiles", + 42 : u"IFW-Free", + 43 : u"Lagardère Active Média", + 44 : u"Outremer Telecom", + 45 : u"RATP", + #46 : Titulaire programme Radio/TV, + 47 : u"Office des Postes et Telecom", + 49 : u"Bolloré", + 48 : u"Neuf Cegetel", + 50 : u"Completel", + 51 : u"Digicel", + 52 : u"Eutelsat", + 53 : u"Expertmedia", + 54 : u"Mediaserv", + 55 : u"Belgacom", + 56 : u"Airbus", + 57 : u"Guyane Numérique", + 58 : u"Dauphin Telecom", + 59 : u"Itas Tim", + 60 : u"Réunion Numérique", + 62 : u"SNCF", + 64 : u"Pacific Mobile Telecom", + 63 : u"Viti", + 61 : u"Globecast", + 69 : u"Zeop", + 68 : u"Cellnex", + 67 : u"Service des Postes et Telecom", + 65 : u"ATC France", + 66 : u"Telco OI" + } From c6eba6310fbb341608582cab8536110252276e51 Mon Sep 17 00:00:00 2001 From: Olyon Date: Sun, 1 Sep 2019 00:33:52 +0200 Subject: [PATCH 2/5] Add files via upload --- merge_data/radio_support_FR.mapping.json | 454 +++++++++++++++++++++++ 1 file changed, 454 insertions(+) create mode 100644 merge_data/radio_support_FR.mapping.json diff --git a/merge_data/radio_support_FR.mapping.json b/merge_data/radio_support_FR.mapping.json new file mode 100644 index 000000000..029de17d4 --- /dev/null +++ b/merge_data/radio_support_FR.mapping.json @@ -0,0 +1,454 @@ +[ + { + "NAT_ID": 0, + "title": "Sans nature", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 4, + "title": "Château d'eau - réservoir", + "tags_select": { + "man_made": "water_tower" + }, + "tags_generate1": { + "man_made": "water_tower", + "antenna": "yes" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 8, + "title": "Intérieur galerie", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna", + "location": "underground" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 9, + "title": "Intérieur sous-terrain", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna", + "location": "underground" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 10, + "title": "Tunnel", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna", + "location": "underground" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 11, + "title": "Mât béton", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "mast", + "tower:type": "communication" + }, + "tags_generate2": { + "material": "concrete" + } + }, + { + "NAT_ID": 12, + "title": "Mât métallique", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "mast", + "tower:type": "communication" + }, + "tags_generate2": { + "material": "steel" + } + }, + { + "NAT_ID": 17, + "title": "Bâtiment", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 19, + "title": "Monument historique", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 20, + "title": "Monument religieux", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 21, + "title": "Pylône", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "mast", + "tower:type": "communication" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 22, + "title": "Pylône autoportant", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "mast", + "tower:type": "communication" + }, + "tags_generate2": { + "tower:construction": "freestanding" + } + }, + { + "NAT_ID": 23, + "title": "Pylône autostable", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "mast", + "tower:type": "communication" + }, + "tags_generate2": { + "tower:construction": "lattice" + } + }, + { + "NAT_ID": 24, + "title": "Pylône haubané", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "mast", + "tower:type": "communication" + }, + "tags_generate2": { + "tower:construction": "guyed" + } + }, + { + "NAT_ID": 25, + "title": "Pylône treillis", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "mast", + "tower:type": "communication" + }, + "tags_generate2": { + "tower:construction": "lattice" + } + }, + { + "NAT_ID": 26, + "title": "Pylône tubulaire", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "mast", + "tower:type": "communication" + }, + "tags_generate2": { + "tower:construction": "freestanding" + } + }, + { + "NAT_ID": 31, + "title": "Silo", + "tags_select": { + "man_made": "silo" + }, + "tags_generate1": { + "man_made": "silo", + "antenna": "yes" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 32, + "title": "Ouvrage d'art (pont, viaduc)", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 33, + "title": "Tour hertzienne", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "communications_tower" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 34, + "title": "Dalle en béton", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 38, + "title": "Immeuble", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 39, + "title": "Local technique", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 40, + "title": "Sémaphore", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 41, + "title": "Phare", + "tags_select": { + "man_made": "lighthouse" + }, + "tags_generate1": { + "man_made": "antenna", + "antenna": "yes" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 42, + "title": "Mât", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "mast", + "tower:type": "communication" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 43, + "title": "Fût", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 44, + "title": "Tour de contrôle", + "tags_select": { + "man_made": "tower", + "service": "aircraft_control" + }, + "tags_generate1": { + "man_made": "tower", + "service": "aircraft_control" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 45, + "title": "Contre-poids au sol", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 46, + "title": "Contre-poids sur shelter", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 47, + "title": "Support DEFENSE", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 48, + "title": "pylône arbre", + "tags_select": [ + {"man_made": "tower","tower:type": "communication"}, + {"man_made": "mast","tower:type": "communication"}, + {"man_made": "communications_tower"} + ], + "tags_generate1": { + "man_made": "mast", + "tower:type": "communication" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 49, + "title": "Ouvrage de signalisation (portique routier, panneau routier, panneau publicitaire)", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 50, + "title": "Balise ou bouée", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 51, + "title": "XXX", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 52, + "title": "Eolienne", + "tags_select": { + "power": "generator", + "generator:source": "wind" + }, + "tags_generate1": { + "power": "generator", + "generator:source": "wind" + }, + "tags_generate2": {} + }, + { + "NAT_ID": 999999999, + "title": "Support non décrit", + "tags_select": { + "man_made": "antenna" + }, + "tags_generate1": { + "man_made": "antenna" + }, + "tags_generate2": {} + } +] From 3b2e99b604657fdf31fe49d5323848b6c233973a Mon Sep 17 00:00:00 2001 From: Olyon Date: Sat, 7 Sep 2019 20:12:28 +0200 Subject: [PATCH 3/5] Add files via upload --- analysers/analyser_merge_radio_support_FR.py | 79 +++++++++++++------- 1 file changed, 54 insertions(+), 25 deletions(-) diff --git a/analysers/analyser_merge_radio_support_FR.py b/analysers/analyser_merge_radio_support_FR.py index f910abe8b..3bef97d73 100644 --- a/analysers/analyser_merge_radio_support_FR.py +++ b/analysers/analyser_merge_radio_support_FR.py @@ -1,36 +1,31 @@ #!/usr/bin/env python #-*- coding: utf-8 -*- -from .Analyser_Merge_Dynamic import Analyser_Merge_Dynamic, SubAnalyser_Merge_Dynamic -from .Analyser_Merge import Source, CSV, Load, Mapping, Select, Generate +from .Analyser_Merge import Analyser_Merge, Source, CSV, Load, Mapping, Select, Generate import json +from io import open -class Analyser_Merge_Radio_Support_FR(Analyser_Merge_Dynamic): - def __init__(self, config, logger = None): - Analyser_Merge_Dynamic.__init__(self, config, logger) - - mapingfile = json.loads(open("merge_data/radio_support_FR.mapping.json").read()) - for r in mapingfile: - self.classFactory(SubAnalyser_Merge_Radio_Support_FR, r['NAT_ID'], r['NAT_ID'], r['title'], r['tags_select'], r['tags_generate1'], r['tags_generate2']) - - -class SubAnalyser_Merge_Radio_Support_FR(SubAnalyser_Merge_Dynamic): - def __init__(self, config, error_file, logger, NAT_ID, title, tags_select, tags_generate1, tags_generate2): +class _Analyser_Merge_Radio_Support_FR(Analyser_Merge): + def __init__(self, config, logger, clas, NAT_IDs, tags_select): - self.missing_official = {"item":"10000", "class": 1+10*NAT_ID, "level": 3, "tag": ["merge"], "desc": T_f(u"Radio support ({0}) not integrated", title) } - self.possible_merge = {"item":"10001", "class": 3+10*NAT_ID, "level": 3, "tag": ["merge"], "desc": T_f(u"Radio support ({0}), integration suggestion", title) } - self.update_official = {"item":"10002", "class": 4+10*NAT_ID, "level": 3, "tag": ["merge"], "desc": T_f(u"Radio support ({0}) update", title) } + self.missing_official = {"item":"8370", "class": 1+10*clas, "level": 3, "tag": ["merge"], "desc": T_(u"Radio support not integrated") } + self.possible_merge = {"item":"8371", "class": 3+10*clas, "level": 3, "tag": ["merge"], "desc": T_(u"Radio support, integration suggestion") } + self.update_official = {"item":"8372", "class": 4+10*clas, "level": 3, "tag": ["merge"], "desc": T_(u"Radio support update") } + mapingfile = json.loads(open("merge_data/radio_support_FR.mapping.json").read()) + self.supportTags = {} + for x in mapingfile : + self.supportTags[x['NAT_ID']] = x self.communeNameIndexedByInsee = {} - with open("dictionaries/FR/BddCommunes", "r") as f : + with open("dictionaries/FR/BddCommunes", "r", encoding="utf-8") as f : for x in f : x = x.split("\t") code_insee = x[0] - name_insee = x[1].strip().decode('utf-8') + name_insee = x[1].strip() self.communeNameIndexedByInsee[code_insee] = name_insee - SubAnalyser_Merge_Dynamic.__init__(self, config, error_file, logger, + Analyser_Merge.__init__(self, config, logger, u"https://www.data.gouv.fr/fr/datasets/donnees-sur-les-installations-radioelectriques-de-plus-de-5-watts-1/", u"Données sur les installations radioélectriques de plus de 5 watts", CSV(Source(attribution = u"data.gouv.fr:ANFR", millesime = "08/2019", @@ -39,7 +34,7 @@ def __init__(self, config, error_file, logger, NAT_ID, title, tags_select, tags_ Load( ("CASE \"COR_CD_EW_LON\" WHEN 'W' THEN -1*(to_number(\"COR_NB_DG_LON\", '99') + to_number(\"COR_NB_MN_LON\", '99') / 60 + to_number(\"COR_NB_SC_LON\", '99') / 3600) WHEN 'E' THEN to_number(\"COR_NB_DG_LON\", '99') + to_number(\"COR_NB_MN_LON\", '99') / 60 + to_number(\"COR_NB_SC_LON\", '99') / 3600 END",), ("CASE \"COR_CD_NS_LAT\" WHEN 'S' THEN -1*(to_number(\"COR_NB_DG_LAT\", '99') + to_number(\"COR_NB_MN_LAT\", '99') / 60 + to_number(\"COR_NB_SC_LAT\", '99') / 3600) WHEN 'N' THEN to_number(\"COR_NB_DG_LAT\", '99') + to_number(\"COR_NB_MN_LAT\", '99') / 60 + to_number(\"COR_NB_SC_LAT\", '99') / 3600 END",), - select = {"NAT_ID": str(NAT_ID)}, + select = {"NAT_ID": NAT_IDs}, uniq = ("SUP_ID",) ), Mapping( @@ -49,16 +44,25 @@ def __init__(self, config, error_file, logger, NAT_ID, title, tags_select, tags_ conflationDistance = 50, osmRef = "ref:FR:ANFR", generate = Generate( - static1 = tags_generate1, - static2 = dict({"source": self.source}, **tags_generate2), + static2 = {"source": self.source}, mapping1 = { "ref:FR:ANFR": "SUP_ID", "owner": lambda fields: self.proprietaire[int(fields["TPO_ID"])] if fields["TPO_ID"] and int(fields["TPO_ID"]) in self.proprietaire else None, - "height": lambda fields: fields["SUP_NM_HAUT"].replace(",", ".") if fields["SUP_NM_HAUT"] else None - }, + "height": lambda fields: fields["SUP_NM_HAUT"].replace(",", ".") if fields["SUP_NM_HAUT"] else None, + "man_made": lambda fields: self.supportTags[int(fields["NAT_ID"])]["tags_generate1"]["man_made"] if "man_made" in self.supportTags[int(fields["NAT_ID"])]["tags_generate1"] else None, + "location": lambda fields: self.supportTags[int(fields["NAT_ID"])]["tags_generate1"]["location"] if "location" in self.supportTags[int(fields["NAT_ID"])]["tags_generate1"] else None, + "tower:type": lambda fields: self.supportTags[int(fields["NAT_ID"])]["tags_generate1"]["tower:type"] if "tower:type" in self.supportTags[int(fields["NAT_ID"])]["tags_generate1"] else None, + "antenna": lambda fields: self.supportTags[int(fields["NAT_ID"])]["tags_generate1"]["antenna"] if "antenna" in self.supportTags[int(fields["NAT_ID"])]["tags_generate1"] else None, + "service": lambda fields: self.supportTags[int(fields["NAT_ID"])]["tags_generate1"]["service"] if "service" in self.supportTags[int(fields["NAT_ID"])]["tags_generate1"] else None, + "power": lambda fields: self.supportTags[int(fields["NAT_ID"])]["tags_generate1"]["power"] if "power" in self.supportTags[int(fields["NAT_ID"])]["tags_generate1"] else None, + "generator:source": lambda fields: self.supportTags[int(fields["NAT_ID"])]["tags_generate1"]["generator:source"] if "generator:source" in self.supportTags[int(fields["NAT_ID"])]["tags_generate1"] else None, + }, mapping2 = { + "material": lambda fields: self.supportTags[int(fields["NAT_ID"])]["tags_generate1"]["material"] if "material" in self.supportTags[int(fields["NAT_ID"])]["tags_generate1"] else None, + "tower:construction": lambda fields: self.supportTags[int(fields["NAT_ID"])]["tags_generate1"]["tower:construction"] if "tower:construction" in self.supportTags[int(fields["NAT_ID"])]["tags_generate1"] else None, }, - text = lambda tags, fields: {"en": u"%s, address : %s, %s" % (title, + + text = lambda tags, fields: {"en": u"radio support : %s, address : %s, %s" % (self.supportTags[int(fields["NAT_ID"])]["title"], ", ".join(filter(lambda x: x != "None", [fields["ADR_LB_LIEU"], fields["ADR_LB_ADD1"], fields["ADR_LB_ADD2"], fields["ADR_LB_ADD3"],fields["ADR_NM_CP"]])), (lambda x: self.communeNameIndexedByInsee[x] if x in self.communeNameIndexedByInsee else x)(fields["COM_CD_INSEE"])) }))) @@ -134,3 +138,28 @@ def __init__(self, config, error_file, logger, NAT_ID, title, tags_select, tags_ 65 : u"ATC France", 66 : u"Telco OI" } + +class Analyser_Merge_Tour_Mat_Pylone(_Analyser_Merge_Radio_Support_FR): + def __init__(self, config, logger = None): + _Analyser_Merge_Radio_Support_FR.__init__(self, config, logger, 0, [u'11', u'12', u'21', u'22', u'23', u'24', u'25', u'26', u'33', u'42', u'44', u'47', u'48'], [{"man_made" : "tower","tower:type" : "communication"},{"man_made" : "mast","tower:type" : "communication"},{"man_made" : "communications_tower"},{"man_made": "tower", "service": "aircraft_control"}]) + +class Analyser_Merge_Antenne(_Analyser_Merge_Radio_Support_FR): + def __init__(self, config, logger = None): + _Analyser_Merge_Radio_Support_FR.__init__(self, config, logger, 1, [u'0', u'8', u'9', u'10', u'17', u'19', u'20', u'32', u'34', u'38', u'39', u'40', u'43', u'45', u'45', u'46', u'49', u'50', u'51', u'999999999'], {"man_made" : "antenna"}) + +class Analyser_Merge_Chateau_Eau(_Analyser_Merge_Radio_Support_FR): + def __init__(self, config, logger = None): + _Analyser_Merge_Radio_Support_FR.__init__(self, config, logger, 2, u'4', {"man_made" : "water_tower"}) + +class Analyser_Merge_Silo(_Analyser_Merge_Radio_Support_FR): + def __init__(self, config, logger = None): + _Analyser_Merge_Radio_Support_FR.__init__(self, config, logger, 2, u'31', {"man_made" : "silo"}) + +class Analyser_Merge_Phare(_Analyser_Merge_Radio_Support_FR): + def __init__(self, config, logger = None): + _Analyser_Merge_Radio_Support_FR.__init__(self, config, logger, 2, u'41', {"man_made" : "lighthouse"}) + +class Analyser_Merge_Eolienne(_Analyser_Merge_Radio_Support_FR): + def __init__(self, config, logger = None): + _Analyser_Merge_Radio_Support_FR.__init__(self, config, logger, 2, u'52', {"power" : "generator","generator:source" : "wind"}) + From 2a3e75c1beb08e018a22357ab1292b7f1524852c Mon Sep 17 00:00:00 2001 From: Olyon Date: Sun, 15 Sep 2019 17:25:39 +0200 Subject: [PATCH 4/5] analyser_merge_wastewater_plant_FR --- .../analyser_merge_wastewater_plant_FR.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 analysers/analyser_merge_wastewater_plant_FR.py diff --git a/analysers/analyser_merge_wastewater_plant_FR.py b/analysers/analyser_merge_wastewater_plant_FR.py new file mode 100644 index 000000000..bec4ee0fe --- /dev/null +++ b/analysers/analyser_merge_wastewater_plant_FR.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +#-*- coding: utf-8 -*- + +from .Analyser_Merge import Analyser_Merge, Source, CSV, Load, Mapping, Select, Generate + +class Analyser_Merge_Wastewater_Plant_FR(Analyser_Merge): + def __init__(self, config, logger = None): + + self.missing_official = {"item":"8380", "class": 1, "level": 3, "tag": ["merge"], "desc": T_(u"Wastewater plant not integrated") } + self.possible_merge = {"item":"8381", "class": 3, "level": 3, "tag": ["merge"], "desc": T_(u"Wastewater plant, integration suggestion") } + self.update_official = {"item":"8382", "class": 4, "level": 3, "tag": ["merge"], "desc": T_(u"Wastewater plant update") } + + Analyser_Merge.__init__(self, config, logger, + u"http://www.sandre.eaufrance.fr/atlas/srv/fre/catalog.search#/metadata/ebef2115-bee5-40bb-b5cc-4593d82ba334", + u"Stations de traitement des eaux usées - France entière", + CSV(Source(attribution = u"Sandre", millesime = "09/2019", + fileUrl = u"http://services.sandre.eaufrance.fr/geo/odp_FRA?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&typename=SysTraitementEauxUsees&SRSNAME=EPSG:4326&OUTPUTFORMAT=CSV")), + Load("LongWGS84OuvrageDepollution", "LatWGS84OuvrageDepollution", + select = {"DateMiseHorServiceOuvrageDepollution": None} + ), + Mapping( + select = Select( + types = ["nodes", "ways"], + tags = {"man_made": "wastewater_plant"}), + conflationDistance = 200, + osmRef = "ref:FR:Sandre", + generate = Generate( + static1 = {"man_made": "wastewater_plant"}, + static2 = {"source": self.source}, + mapping1 = {"ref:FR:Sandre": "CdOuvrageDepollution", + "start_date" : lambda fields: None if not fields.get(u"DateMiseServiceOuvrageDepollution") else fields[u"DateMiseServiceOuvrageDepollution"][0:4] if fields[u"DateMiseServiceOuvrageDepollution"].endswith('-01-01') or fields[u"DateMiseServiceOuvrageDepollution"].endswith('-12-31') else fields[u"DateMiseServiceOuvrageDepollution"]}, + text = lambda tags, fields: {"en": ', '.join(filter(lambda x: x, [fields["NomOuvrageDepollution"], fields["LbSystemeCollecte"], fields["NomAgglomerationAssainissement"]]))}))) + From 8c709f2bb0b02b909a71b5d6e2a36909add325b9 Mon Sep 17 00:00:00 2001 From: Olyon Date: Sun, 15 Sep 2019 17:47:03 +0200 Subject: [PATCH 5/5] Delete analyser_merge_wastewater_plant_FR.py --- .../analyser_merge_wastewater_plant_FR.py | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 analysers/analyser_merge_wastewater_plant_FR.py diff --git a/analysers/analyser_merge_wastewater_plant_FR.py b/analysers/analyser_merge_wastewater_plant_FR.py deleted file mode 100644 index bec4ee0fe..000000000 --- a/analysers/analyser_merge_wastewater_plant_FR.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python -#-*- coding: utf-8 -*- - -from .Analyser_Merge import Analyser_Merge, Source, CSV, Load, Mapping, Select, Generate - -class Analyser_Merge_Wastewater_Plant_FR(Analyser_Merge): - def __init__(self, config, logger = None): - - self.missing_official = {"item":"8380", "class": 1, "level": 3, "tag": ["merge"], "desc": T_(u"Wastewater plant not integrated") } - self.possible_merge = {"item":"8381", "class": 3, "level": 3, "tag": ["merge"], "desc": T_(u"Wastewater plant, integration suggestion") } - self.update_official = {"item":"8382", "class": 4, "level": 3, "tag": ["merge"], "desc": T_(u"Wastewater plant update") } - - Analyser_Merge.__init__(self, config, logger, - u"http://www.sandre.eaufrance.fr/atlas/srv/fre/catalog.search#/metadata/ebef2115-bee5-40bb-b5cc-4593d82ba334", - u"Stations de traitement des eaux usées - France entière", - CSV(Source(attribution = u"Sandre", millesime = "09/2019", - fileUrl = u"http://services.sandre.eaufrance.fr/geo/odp_FRA?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&typename=SysTraitementEauxUsees&SRSNAME=EPSG:4326&OUTPUTFORMAT=CSV")), - Load("LongWGS84OuvrageDepollution", "LatWGS84OuvrageDepollution", - select = {"DateMiseHorServiceOuvrageDepollution": None} - ), - Mapping( - select = Select( - types = ["nodes", "ways"], - tags = {"man_made": "wastewater_plant"}), - conflationDistance = 200, - osmRef = "ref:FR:Sandre", - generate = Generate( - static1 = {"man_made": "wastewater_plant"}, - static2 = {"source": self.source}, - mapping1 = {"ref:FR:Sandre": "CdOuvrageDepollution", - "start_date" : lambda fields: None if not fields.get(u"DateMiseServiceOuvrageDepollution") else fields[u"DateMiseServiceOuvrageDepollution"][0:4] if fields[u"DateMiseServiceOuvrageDepollution"].endswith('-01-01') or fields[u"DateMiseServiceOuvrageDepollution"].endswith('-12-31') else fields[u"DateMiseServiceOuvrageDepollution"]}, - text = lambda tags, fields: {"en": ', '.join(filter(lambda x: x, [fields["NomOuvrageDepollution"], fields["LbSystemeCollecte"], fields["NomAgglomerationAssainissement"]]))}))) -