|
| 1 | +#!/usr/bin/env python |
| 2 | +#-*- coding: utf-8 -*- |
| 3 | + |
| 4 | +########################################################################### |
| 5 | +## ## |
| 6 | +## Copyrights François Lacombe - 2024 ## |
| 7 | +## ## |
| 8 | +## This program is free software: you can redistribute it and/or modify ## |
| 9 | +## it under the terms of the GNU General Public License as published by ## |
| 10 | +## the Free Software Foundation, either version 3 of the License, or ## |
| 11 | +## (at your option) any later version. ## |
| 12 | +## ## |
| 13 | +## This program is distributed in the hope that it will be useful, ## |
| 14 | +## but WITHOUT ANY WARRANTY; without even the implied warranty of ## |
| 15 | +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## |
| 16 | +## GNU General Public License for more details. ## |
| 17 | +## ## |
| 18 | +## You should have received a copy of the GNU General Public License ## |
| 19 | +## along with this program. If not, see <http://www.gnu.org/licenses/>. ## |
| 20 | +## ## |
| 21 | +########################################################################### |
| 22 | + |
| 23 | +from modules.OsmoseTranslation import T_ |
| 24 | +from .Analyser_Merge import Analyser_Merge_Point, Source, GDAL, LoadGeomCentroid, Conflate, Select, Mapping |
| 25 | + |
| 26 | + |
| 27 | +class Analyser_Merge_power_pole_FR_spec_sdey (Analyser_Merge_Point): |
| 28 | + def __init__(self, config, logger = None): |
| 29 | + Analyser_Merge_Point.__init__(self, config, logger) |
| 30 | + self.def_class_missing_official(item = 8290, id = 1001, level = 3, tags = ['merge', 'power', 'fix:chair', 'fix:survey'], |
| 31 | + title = T_('Power pole not integrated')) |
| 32 | + self.def_class_possible_merge(item = 8291, id = 1003, level = 3, tags = ['merge', 'power', 'fix:chair', 'fix:survey'], |
| 33 | + title = T_('Power pole integration suggestion')) |
| 34 | + self.def_class_update_official(item = 8290, id = 1004, level = 3, tags = ['merge', 'power', 'fix:chair', 'fix:survey'], |
| 35 | + title = T_('Power pole update')) |
| 36 | + |
| 37 | + self.init( |
| 38 | + "https://trouver.ternum-bfc.fr/dataset/support-poteau-des-luminaires", |
| 39 | + "Support poteau des luminaires", |
| 40 | + GDAL(Source( |
| 41 | + attribution="Syndicat Départemental d'Energies de l'Yonne", |
| 42 | + fileUrl="https://trouver.ternum-bfc.fr/dataset/bd94f0e8-b76b-4135-828f-c84e9711e348/resource/e21e39bc-5b51-4c23-b737-1e698ad41d0c/download/pt_lum_89_support_poteau.zip"), |
| 43 | + srid = 2154, |
| 44 | + zip="*.shp"), |
| 45 | + LoadGeomCentroid(select = {"natursupor": ["EP+BT", "EP+BT+FT"]} ), |
| 46 | + Conflate( |
| 47 | + select = Select( |
| 48 | + types = ['nodes'], |
| 49 | + tags = {'power': 'pole'}), |
| 50 | + conflationDistance = 5, |
| 51 | + mapping = Mapping( |
| 52 | + static1 = {'power': 'pole'}, |
| 53 | + static2 = {'source': self.source, 'highway': 'street_lamp'}, |
| 54 | + mapping1 = { |
| 55 | + 'material': lambda res: self.extract_material.get(res['matieresup']), |
| 56 | + 'operator': lambda res: self.extract_operator.get(res['natursupor']), |
| 57 | + 'height': lambda res: res['haut_mat_m'] if res['haut_mat_m'] and res['haut_mat_m'].isnumeric() and float(res['haut_mat_m']) > 6.0 else None}, |
| 58 | + text = lambda tags, fields: {} ))) |
| 59 | + |
| 60 | + extract_operator = { |
| 61 | + 'EP+BT': 'Enedis', |
| 62 | + 'EP+BT+FT': 'Enedis' |
| 63 | + } |
| 64 | + |
| 65 | + extract_material = { |
| 66 | + 'BOIS': 'wood', |
| 67 | + 'BETON': 'concrete', |
| 68 | + 'ACIER': 'steel' |
| 69 | + } |
0 commit comments