Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add merge analyser for French power poles in Vendee #2394

Merged
merged 8 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions analysers/Analyser_Merge_power_pole_FR_gracethd2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env python
#-*- coding: utf-8 -*-

###########################################################################
## ##
## Copyrights François Lacombe - 2024 ##
## ##
## This program is free software: you can redistribute it and/or modify ##
## it under the terms of the GNU General Public License as published by ##
## the Free Software Foundation, either version 3 of the License, or ##
## (at your option) any later version. ##
## ##
## This program is distributed in the hope that it will be useful, ##
## but WITHOUT ANY WARRANTY; without even the implied warranty of ##
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ##
## GNU General Public License for more details. ##
## ##
## You should have received a copy of the GNU General Public License ##
## along with this program. If not, see <http://www.gnu.org/licenses/>. ##
## ##
###########################################################################

from modules.OsmoseTranslation import T_
from .Analyser_Merge import Analyser_Merge_Point, SHP, LoadGeomCentroid, Conflate, Select, Mapping


class Analyser_Merge_power_pole_FR_gracethd2 (Analyser_Merge_Point):
def __init__(self, config, source_url, dataset_name, source, srid, conflationDistance, classs, extract_operator = None, logger = None):
Analyser_Merge_Point.__init__(self, config, logger)
self.def_class_missing_official(item = 8290, id = classs + 1, level = 3, tags = ['merge', 'power', 'fix:chair', 'fix:survey'],
title = T_('Power pole not integrated'))
self.def_class_possible_merge(item = 8291, id = classs + 3, level = 3, tags = ['merge', 'power', 'fix:chair', 'fix:survey'],
title = T_('Power pole integration suggestion'))
self.def_class_update_official(item = 8290, id = classs + 4, level = 3, tags = ['merge', 'power', 'fix:chair', 'fix:survey'],
title = T_('Power pole update'))

self.init(
source_url,
dataset_name,
SHP(source, srid = srid, zip="*.shp"),
LoadGeomCentroid(select = {"modele": ["PBOI", "PBET", "PCMP", "PMET"]}),
Conflate(
select = Select(
types = ['nodes'],
tags = {'power': 'pole'}),
conflationDistance = conflationDistance,
mapping = Mapping(
static1 = {'power': 'pole'},
static2 = {'source': self.source},
mapping1 = {
'material': lambda res: self.extract_material.get(res['modele']),
'operator': lambda res: extract_operator.get(res['gestionnai']) if res['gestionnai'] and extract_operator.get(res['gestionnai']) else extract_operator.get(res['proprietai']) if res['proprietai'] and extract_operator.get(res['proprietai']) else None,
flacombe marked this conversation as resolved.
Show resolved Hide resolved
'height': lambda res: res['prof_haut'] if res['prof_haut'] and float(res['prof_haut']) > 6.0 else None},
text = lambda tags, fields: {} )))

extract_material = {
'PBOI': 'wood',
'PBET': 'concrete',
'PCMP': 'epoxy',
'PMET': 'steel'
}
frodrigo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from .Analyser_Merge import Analyser_Merge_Point, SHP, LoadGeomCentroid, Conflate, Select, Mapping


class Analyser_Merge_power_pole_FR_gracethd (Analyser_Merge_Point):
class Analyser_Merge_power_pole_FR_gracethd3 (Analyser_Merge_Point):
def __init__(self, config, source_url, dataset_name, source, srid, conflationDistance, classs, extract_operator = None, logger = None):
Analyser_Merge_Point.__init__(self, config, logger)
self.def_class_missing_official(item = 8290, id = classs + 1, level = 3, tags = ['merge', 'power', 'fix:chair', 'fix:survey'],
Expand Down
41 changes: 41 additions & 0 deletions analysers/analyser_merge_power_pole_FR_gracethd2_vendee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python
#-*- coding: utf-8 -*-

###########################################################################
## ##
## Copyrights François Lacombe - 2024 ##
## ##
## This program is free software: you can redistribute it and/or modify ##
## it under the terms of the GNU General Public License as published by ##
## the Free Software Foundation, either version 3 of the License, or ##
## (at your option) any later version. ##
## ##
## This program is distributed in the hope that it will be useful, ##
## but WITHOUT ANY WARRANTY; without even the implied warranty of ##
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ##
## GNU General Public License for more details. ##
## ##
## You should have received a copy of the GNU General Public License ##
## along with this program. If not, see <http://www.gnu.org/licenses/>. ##
## ##
###########################################################################

from .Analyser_Merge_power_pole_FR_gracethd2 import Analyser_Merge_power_pole_FR_gracethd2
from .Analyser_Merge import SourceDataGouv

class Analyser_Merge_power_pole_FR_gracethd2_vendee(Analyser_Merge_power_pole_FR_gracethd2):
def __init__(self, config, logger = None):
Analyser_Merge_power_pole_FR_gracethd2.__init__(self, config,
source_url='https://www.data.gouv.fr/fr/datasets/appuis-aeriens-enedis-utilises-dans-le-cadre-du-deploiement-de-la-fibre-sur-le-rip-de-la-vendee/',
dataset_name='Appuis aériens ENEDIS utilisés dans le cadre du déploiement de la Fibre sur le RIP de la Vendée',
source=SourceDataGouv(
attribution="Vendée Numérique",
dataset="673d09a837eab9c52f42268b",
resource="cc66ae17-26a2-43f5-aea3-37496775776c"),
srid = 2154,
conflationDistance=5,
classs=1000,
extract_operator = {
'ENEDIS': 'Enedis'
},
logger=logger)
frodrigo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
## ##
###########################################################################

from .Analyser_Merge_power_pole_FR_gracethd import Analyser_Merge_power_pole_FR_gracethd
from .Analyser_Merge_power_pole_FR_gracethd3 import Analyser_Merge_power_pole_FR_gracethd3
from .Analyser_Merge import SourceDataGouv

class Analyser_Merge_power_pole_FR_gracethd_bretagne(Analyser_Merge_power_pole_FR_gracethd):
class Analyser_Merge_power_pole_FR_gracethd3_bretagne(Analyser_Merge_power_pole_FR_gracethd3):
def __init__(self, config, logger = None):
Analyser_Merge_power_pole_FR_gracethd.__init__(self, config,
Analyser_Merge_power_pole_FR_gracethd3.__init__(self, config,
source_url='https://www.data.gouv.fr/fr/datasets/recensement-poteaux-enedis-reutilises-dans-le-cadre-du-deploiement-ftth-du-projet-bretagne-tres-haut-debit/',
dataset_name='Recensement poteaux ENEDIS réutilisés dans le cadre du déploiement FTTH du projet Bretagne Très Haut Débit',
source=SourceDataGouv(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
## ##
###########################################################################

from .Analyser_Merge_power_pole_FR_gracethd import Analyser_Merge_power_pole_FR_gracethd
from .Analyser_Merge_power_pole_FR_gracethd3 import Analyser_Merge_power_pole_FR_gracethd3
from .Analyser_Merge import SourceDataGouv

class Analyser_Merge_power_pole_FR_gracethd_dordogne(Analyser_Merge_power_pole_FR_gracethd):
class Analyser_Merge_power_pole_FR_gracethd3_dordogne(Analyser_Merge_power_pole_FR_gracethd3):
def __init__(self, config, logger = None):
Analyser_Merge_power_pole_FR_gracethd.__init__(self, config,
Analyser_Merge_power_pole_FR_gracethd3.__init__(self, config,
source_url='https://www.data.gouv.fr/fr/datasets/appuis-aeriens-enedis-utilises-dans-le-cadre-du-deploiement-de-la-fibre-sur-le-rip-de-la-dordogne/',
dataset_name='Appuis aériens ENEDIS utilisés dans le cadre du déploiement de la Fibre sur le RIP de la Dordogne',
source=SourceDataGouv(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
## ##
###########################################################################

from .Analyser_Merge_power_pole_FR_gracethd import Analyser_Merge_power_pole_FR_gracethd
from .Analyser_Merge_power_pole_FR_gracethd3 import Analyser_Merge_power_pole_FR_gracethd3
from .Analyser_Merge import SourceDataGouv

class Analyser_Merge_power_pole_FR_gracethd_jura(Analyser_Merge_power_pole_FR_gracethd):
class Analyser_Merge_power_pole_FR_gracethd3_jura(Analyser_Merge_power_pole_FR_gracethd3):
def __init__(self, config, logger = None):
Analyser_Merge_power_pole_FR_gracethd.__init__(self, config,
Analyser_Merge_power_pole_FR_gracethd3.__init__(self, config,
source_url='https://www.data.gouv.fr/fr/datasets/appuis-aeriens-enedis-utilises-dans-le-cadre-du-deploiement-de-la-fibre-sur-le-rip-du-jura/',
dataset_name='Appuis aériens ENEDIS utilisés dans le cadre du déploiement de la Fibre sur le RIP du Jura',
source=SourceDataGouv(
Expand Down
Loading