Skip to content

Commit

Permalink
Add merge analyser for French power poles in Vendee (#2394)
Browse files Browse the repository at this point in the history
  • Loading branch information
flacombe authored Dec 1, 2024
1 parent a37f42f commit 90da9bd
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 15 deletions.
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'], extract_operator.get(res['proprietai'])),
'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'
}
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 All @@ -49,7 +49,7 @@ def __init__(self, config, source_url, dataset_name, source, srid, conflationDis
static2 = {'source': self.source},
mapping1 = {
'material': lambda res: self.extract_material.get(res['pt_nature']),
'operator': lambda res: extract_operator.get(res['pt_gest']) if res['pt_gest'] and extract_operator.get(res['pt_gest']) else extract_operator.get(res['pt_prop']) if res['pt_prop'] and extract_operator.get(res['pt_prop']) else None,
'operator': lambda res: extract_operator.get(res['pt_gest'], extract_operator.get(res['pt_prop'])),
'height': lambda res: res['pt_a_haut'] if res['pt_a_haut'] and float(res['pt_a_haut']) > 6.0 else None},
text = lambda tags, fields: {} )))

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)
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
10 changes: 6 additions & 4 deletions osmose_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class gen(default_country):
'merge_winery_FR_aquitaine',
]
france_departement("aquitaine/dordogne", 7375, "FR-24", include=include_aquitaine + [
'merge_power_pole_FR_gracethd_dordogne'
'merge_power_pole_FR_gracethd3_dordogne'
])
france_departement("aquitaine/gironde", 7405, "FR-33", include=include_aquitaine + [
# Bordeaux
Expand Down Expand Up @@ -349,7 +349,7 @@ class gen(default_country):

include_bretagne = [
# Bretagne
'merge_power_pole_FR_gracethd_bretagne'
'merge_power_pole_FR_gracethd3_bretagne'
]
france_departement("bretagne/cotes_d_armor", 7398, "FR-22", include=include_bretagne)
france_departement("bretagne/ille_et_vilaine", 7465, "FR-35", include=include_bretagne + [
Expand Down Expand Up @@ -385,7 +385,7 @@ class gen(default_country):
france_departement("franche_comte/doubs", 7462, "FR-25")
france_departement("franche_comte/jura", 7460, "FR-39", include=[
'merge_hydrants_FR_SDIS_39',
'merge_power_pole_FR_gracethd_jura'
'merge_power_pole_FR_gracethd3_jura'
])
france_departement("franche_comte/haute_saone", 7423, "FR-70")
france_departement("franche_comte/territoire_de_belfort", 7410, "FR-90")
Expand Down Expand Up @@ -472,7 +472,9 @@ class gen(default_country):
])
france_departement("pays_de_la_loire/mayenne", 7438, "FR-53")
france_departement("pays_de_la_loire/sarthe", 7443, "FR-72")
france_departement("pays_de_la_loire/vendee", 7402, "FR-85")
france_departement("pays_de_la_loire/vendee", 7402, "FR-85", include=[
'merge_power_pole_FR_gracethd2_vendee'
])

france_departement("picardie/aisne", 7411, "FR-02")
france_departement("picardie/oise", 7427, "FR-60")
Expand Down

0 comments on commit 90da9bd

Please sign in to comment.