def __init__(self, config, logger = None):
     self.missing_official = {"item":"8070", "class": 1, "level": 3, "tag": ["merge"], "desc": T_(u"Missing survey point") }
     self.moved_official = {"item":"8070", "class": 3, "level": 3, "tag": ["merge"], "desc": T_(u"Moved survey point")}
     Analyser_Merge.__init__(self, config, logger,
         "http://geodesie.ign.fr",
         u"Fiches géodésiques",
         CSV(Source(attribution = u"©IGN %s dans le cadre de la cartographie réglementaire", millesime = "2010",
                 file = "geodesie.csv.bz2"),
             header = False),
         Load("lon", "lat",
             create = """
                 id VARCHAR(254) PRIMARY KEY,
                 lat VARCHAR(254),
                 lon VARCHAR(254),
                 description VARCHAR(4096),
                 ele VARCHAR(254),
                 ref VARCHAR(254)"""),
         Mapping(
             select = Select(
                 types = ["nodes"],
                 tags = {"man_made": "survey_point"}),
             osmRef = "ref",
             extraJoin = "description",
             generate = Generate(
                 static1 = {
                     "man_made": "survey_point"},
                 static2 = {
                     "note": u"Ne pas déplacer ce point, cf. - Do not move this node, see - http://wiki.openstreetmap.org/wiki/WikiProject_France/Repères_Géodésiques#Permanence_des_rep.C3.A8res",
                     "source": self.source},
                 mapping1 = {
                     "ref": "ref",
                     "ele": "ele"},
                 mapping2 = {
                     "description": "description"},
                 text = lambda tags, fields: {"en": u"Survey point %s" % tags["ref"], "fr": u"Repères géodésiques %s" % tags["ref"], "es": u"Señales geodésicas %s" % tags["ref"]} )))
    def __init__(self, config, logger = None):
        self.missing_official = {"item":"8240", "class": 11, "level": 3, "tag": ["merge", "amenity"], "desc": T_(u"Restaurant not integrated") }

        start_restaurant = re.compile("^(hôtel-)?restaurant ", flags=re.IGNORECASE)
        final_name = re.compile("/.*$")

        Analyser_Merge.__init__(self, config, logger,
            "http://opendata71interactive.cloudapp.net/DataBrowser/data/CG71Restaurants",
            u"Les restaurants en Saône-et-Loire - CG71",
            CSV(Source(attribution = u"Conseil général de la Saône-et-Loire - Agence de Développement Touristique", millesime = "03/2013",
                    fileUrl = "http://opendata71interactive.cloudapp.net/DataBrowser/DownloadCsv?container=data&entitySet=CG71Restaurants&filter=NOFILTER", encoding = "ISO-8859-15"),
                separator = ";"),
            Load("LONGITUDE", "LATITUDE",
                xFunction = self.float_comma,
                yFunction = self.float_comma),
            Mapping(
                select = Select(
                    types = ["nodes", "ways"],
                    tags = {"amenity": "restaurant"}),
                conflationDistance = 100,
                generate = Generate(
                    static1 = {"amenity": "restaurant"},
                    static2 = {"source": self.source},
                    mapping1 = {
                        "amenity": lambda fields: self.amenity_type.get(fields["CATEGORIE"]) or "restaurant",
                        "name": lambda fields: final_name.sub('', start_restaurant.sub('', fields["NOM"])),
                        "tourism": lambda fields: "hotel" if fields["TYPE_RESTAURATION"] == u"Hotel-restaurant" else None,
                        "cuisine": lambda fields: self.cuisine(fields),
                        "website": "SITE_WEB",
                        "stars": lambda fields: len(fields["note_Guide_Rouge_Michelin"]) if fields["note_Guide_Rouge_Michelin"] else None},
                    text = lambda tags, fields: {"en": ', '.join(filter(lambda x: x != "None", [fields["NOM"], fields["TYPE_RESTAURATION"], fields["CATEGORIE"], fields["ADRESSE1"], fields["ADRESSE2"], fields["ADRESSE3"], fields["VILLE"]]))} )))
예제 #3
0
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "8120",
         "class": 11,
         "level": 3,
         "tag": ["merge", "recycling"],
         "desc": T_(u"CAPP glass recycling not integrated")
     }
     Analyser_Merge.__init__(
         self,
         config,
         logger,
         "http://opendata.agglo-pau.fr/index.php/fiche?idQ=8",
         u"Point d'apport volontaire du verre : Bornes à verres sur la CAPP",
         # Dod_Bav_CC43.csv is in WGS84
         CSV(
             Source(attribution=u"Communauté d'Agglomération Pau-Pyrénées",
                    millesime="01/2013",
                    fileUrl=
                    "http://opendata.agglo-pau.fr/sc/call.php?f=1&idf=8",
                    zip="Dod_Bav_CC43.csv")),
         Load("X",
              "Y",
              xFunction=self.float_comma,
              yFunction=self.float_comma,
              select={"USAGE_": "En service"}),
         Mapping(select=Select(types=["nodes", "ways"],
                               tags={"amenity": "recycling"}),
                 conflationDistance=100,
                 generate=Generate(static1={
                     "amenity": "recycling",
                     "recycling:glass_bottles": "yes",
                     "recycling_type": "container"
                 },
                                   static2={"source": self.source})))
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "8150",
         "class": 11,
         "level": 3,
         "tag": ["merge", "public equipment", "cycle"],
         "desc": T_(u"CAPP bicycle parking not integrated")
     }
     Analyser_Merge.__init__(
         self, config, logger,
         "http://opendata.agglo-pau.fr/index.php/fiche?idQ=20",
         u"Supports vélos sur la CAPP",
         CSV(
             Source(attribution=u"Communauté d'Agglomération Pau-Pyrénées",
                    millesime="01/2013",
                    fileUrl=
                    "http://opendata.agglo-pau.fr/sc/call.php?f=1&idf=20",
                    zip="Sta_Velo_Agglo_WGS84.csv")),
         Load("X",
              "Y",
              xFunction=self.float_comma,
              yFunction=self.float_comma),
         Mapping(
             select=Select(types=["nodes"],
                           tags={"amenity": "bicycle_parking"}),
             conflationDistance=50,
             generate=Generate(static1={"amenity": "bicycle_parking"},
                               static2={"source": self.source},
                               mapping1={
                                   "capacity":
                                   lambda res: str(int(res["NOMBRE"]) * 2)
                               })))
    def __init__(self, config, logger = None):
        self.missing_official = {"item":"8290", "class": 1, "level": 3, "tag": ["merge", "power"], "desc": T_(u"Power support not integrated") }
        self.missing_osm      = {"item":"7200", "class": 2, "level": 3, "tag": ["merge", "power"], "desc": T_(u"Power support without ref") }
        self.possible_merge   = {"item":"8291", "class": 3, "level": 3, "tag": ["merge", "power"], "desc": T_(u"Power support, integration suggestion") }

        Analyser_Merge.__init__(self, config, logger,
            "https://opendata.rte-france.com/explore/dataset/pylones/",
            u"Pylones RTE",
            CSV(Source(attribution = u"data.gouv.fr:RTE", millesime = "04/2017",
                    fileUrl = "https://opendata.rte-france.com/explore/dataset/pylones/download/?format=csv&timezone=Europe/Berlin&use_labels_for_header=true"),
                separator = ";"),
            Load("Longitude du pylône (DD)", "Latitude du pylône (DD)"),
            Mapping(
                select = Select(
                    types = ["nodes"],
                    tags = [{"power": "tower", "operator": "RTE"}, {"power": "pole", "operator": "RTE"}, {"power": "terminal", "operator": "RTE"}, {"power": "portal", "operator": "RTE"}, {"power": "insulator", "operator": "RTE"},
                      {"power": "tower", "operator": False}, {"power": "pole", "operator": False}, {"power": "terminal", "operator": False}, {"power": "portal", "operator": False}, {"power": "insulator", "operator": False}]),
#                osmRef = "ref:FR:RTE", # Commented initial. Only issues missing tower. Then when the missing tower number lower, uncomment to integrate ref into OSM.
                conflationDistance = 10,
                generate = Generate(
                    static1 = {
                        "power": "tower",
                        "operator": "RTE"},
                    static2 = {"source": self.source},
                    mapping1 = {
                        "ref": "Numéro de pylône"},
                    mapping2 = {
                        "height": "Hauteur du pylône (m)"})))
예제 #6
0
 def __init__(self, config, logger=None):
     _Analyser_Merge_Street_Number.__init__(
         self, config, 7, "Rennes", logger,
         "http://www.data.rennes-metropole.fr/les-donnees/catalogue/?tx_icsopendatastore_pi1[uid]=217",
         u"Référentiel voies et adresses de Rennes Métropole",
         CSV(Source(
             attribution=u"Rennes Métropole",
             millesime="05/2013",
             fileUrl=
             "http://www.data.rennes-metropole.fr/fileadmin/user_upload/data/data_sig/referentiels/voies_adresses/voies_adresses_csv.zip",
             zip="voies_adresses_csv/donnees/rva_adresses.csv"),
             separator=";"),
         Load("X_WGS84",
              "Y_WGS84",
              xFunction=self.float_comma,
              yFunction=self.float_comma),
         Mapping(generate=Generate(
             static2={"source": self.source},
             mapping1={
                 "addr:housenumber":
                 lambda res: res["NUMERO"] + (res["EXTENSION"]
                                              if res["EXTENSION"] else "") +
                 ((" " + res["BATIMENT"]) if res["BATIMENT"] else "")
             },
             text=lambda tags, fields: {"en": fields["ADR_CPLETE"]})))
예제 #7
0
 def __init__(self, config, error_file, logger, classs, topic, osmTags, defaultTags):
     self.missing_official = {"item":"8260", "class": classs, "level": 3, "tag": ["merge"], "desc": T_(u"Geodesic support not integrated %s", topic.replace("^", "").replace("|", ", ")) }
     SubAnalyser_Merge_Dynamic.__init__(self, config, error_file, logger,
         "http://geodesie.ign.fr",
         u"Fiches géodésiques",
         CSV(Source(attribution = u"©IGN 2010 dans le cadre de la cartographie réglementaire",
                 file = "geodesie.csv.bz2"),
             header = False),
         Load("lon", "lat",
             create = """
                 id VARCHAR(254) PRIMARY KEY,
                 lat VARCHAR(254),
                 lon VARCHAR(254),
                 description VARCHAR(4096),
                 ele VARCHAR(254),
                 ref VARCHAR(254)""",
             where = lambda res: not 'ruine' in res['description'].lower() and not 'ancien' in res['description'].lower() and not u'détruit' in res['description'].lower() and re.search(topic, res['description'], re.IGNORECASE)),
         Mapping(
             select = Select(
                 types = ["nodes", "ways"],
                 tags = osmTags),
             conflationDistance = 200,
             generate = Generate(
                 static1 = dict(dict(**osmTags), **defaultTags),
                 static2 = {"source": lambda a: a.parser.source.attribution},
             text = lambda tags, fields: {"en": fields["description"]} )))
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "8060",
         "class": 1,
         "level": 3,
         "tag": ["merge", "railway"],
         "desc": T_(u"Crossing level not integrated")
     }
     Analyser_Merge.__init__(
         self, config, logger,
         "https://www.data.gouv.fr/fr/datasets/passages-a-niveau-30383135/",
         u"Passages à niveau",
         CSV(Source(
             attribution=u"data.gouv.fr:RFF",
             millesime="01/2014",
             fileUrl=
             "http://static.data.gouv.fr/c5/caae14a4ab1f6530f4c24b3e3c25b4a4f753556a8eda7cbf989501626ff400.csv",
             encoding="ISO-8859-15"),
             separator=";"),
         Load("LONGITUDE (WGS84)",
              "LATITUDE (WGS84)",
              xFunction=self.float_comma,
              yFunction=self.float_comma,
              where=lambda res: res["TYPE"] != 'PN de classe 00'),
         Mapping(
             select=Select(types=["nodes"],
                           tags={"railway": ["level_crossing",
                                             "crossing"]}),
             conflationDistance=150,
             generate=Generate(
                 static2={"source": self.source},
                 mapping1={"railway": lambda res: self.type[res["TYPE"]]})))
 def __init__(self, config, logger = None):
     self.missing_official = {"item":"8050", "class": 1, "level": 3, "tag": ["merge", "railway"], "desc": T_(u"Railway station not integrated") }
     self.missing_osm      = {"item":"7100", "class": 2, "level": 3, "tag": ["merge", "railway"], "desc": T_(u"Railway station without uic_ref or invalid") }
     self.possible_merge   = {"item":"8051", "class": 3, "level": 3, "tag": ["merge", "railway"], "desc": T_(u"Railway station, integration suggestion") }
     Analyser_Merge.__init__(self, config, logger,
         "https://ressources.data.sncf.com/explore/dataset/sncf-ter-gtfs/",
         u"Horaires prévus des trains TER",
         CSV(Source(attribution = u"SNCF", millesime = "03/2017",
                 fileUrl = "http://medias.sncf.com/sncfcom/open-data/gtfs/export-TER-GTFS-LAST.zip", zip = "stops.txt")),
         Load("stop_lon", "stop_lat",
             select = {"stop_id": "StopArea:%"}),
         Mapping(
             select = Select(
                 types = ["nodes", "ways"],
                 tags = {"railway": ["station", "halt"]}),
             osmRef = "uic_ref",
             conflationDistance = 500,
             generate = Generate(
                 static1 = {
                     "railway": "station",
                     "operator": "SNCF"},
                 static2 = {"source": self.source},
                 mapping1 = {"uic_ref": lambda res: res["stop_id"].split(":")[1][3:].split("-")[-1][:-1]},
                 mapping2 = {"name": lambda res: res["stop_name"].replace("gare de ", "")},
                 text = lambda tags, fields: {"en": fields["stop_name"][0].upper() + fields["stop_name"][1:]} )))
예제 #10
0
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "8190",
         "class": 1,
         "level": 3,
         "tag": ["merge"],
         "desc": T_(u"Police not integrated")
     }
     Analyser_Merge.__init__(
         self, config, logger,
         "http://www.data.gouv.fr/fr/dataset/liste-des-points-d-accueil-de-la-gendarmerie-nationale-avec-geolocalisation",
         u"Liste des points d'accueil de la gendarmerie nationale avec géolocalisation",
         CSV(Source(
             attribution=u"data.gouv.fr:Ministère de l'Intérieur",
             millesime="02/2016",
             fileUrl=
             "https://www.data.gouv.fr/s/resources/liste-des-points-d-accueil-de-la-gendarmerie-nationale-avec-geolocalisation/20160211-105304/ETALABexport_gn.csv"
         ),
             separator=";"), Load("geocodage_x_GPS", "geocodage_y_GPS"),
         Mapping(select=Select(types=["nodes", "ways"],
                               tags={"amenity": "police"}),
                 conflationDistance=1000,
                 generate=Generate(
                     static1={
                         "amenity": "police",
                         "operator": "Gendarmerie Nationale"
                     },
                     static2={"source": self.source},
                     mapping2={"phone": "telephone"},
                     text=lambda tags, fields: {
                         "en":
                         u"%s, %s" %
                         (fields["service"], fields["adresse_geographique"])
                     })))
 def __init__(self, config, logger=None):
     self.update_official = {
         "item": "8101",
         "class": 100,
         "level": 3,
         "tag": ["merge", "wikipedia"],
         "desc": T_(u"Update Wikipedia tag")
     }
     Analyser_Merge.__init__(
         self, config, logger, "http://wikipedia.fr", "wikipedia insee",
         CSV(Source(file="wikipedia_insee_FR.csv.bz2")),
         Load(create="""
                 insee VARCHAR(254) PRIMARY KEY,
                 title VARCHAR(254)"""),
         Mapping(select=Select(types=["relations"],
                               tags={
                                   "type": "boundary",
                                   "boundary": "administrative",
                                   "admin_level": "8"
                               }),
                 osmRef="ref:INSEE",
                 generate=Generate(
                     mapping1={
                         "ref:INSEE": "insee",
                         "wikipedia": lambda res: "fr:" + res["title"]
                     })))
 def __init__(self, config, logger, clas, conflationDistance, select, osmTags, defaultTag):
     self.missing_official = {"item":"8040", "class": 1+10*clas, "level": 3, "tag": ["merge", "railway", "public transport"], "desc": T_(u"STIF public transport stop not integrated") }
     self.possible_merge   = {"item":"8041", "class": 3+10*clas, "level": 3, "tag": ["merge", "railway", "public transport"], "desc": T_(u"STIF public transport stop, integration suggestion") }
     Analyser_Merge.__init__(self, config, logger,
         "https://opendata.stif.info/explore/dataset/referentiel-arret-tc-idf/information/",
         u"Référentiel des arrêts de transport en commun en Ile-de-France",
         CSV(Source(attribution = u"STIF", millesime = "12/2016",
                 fileUrl = u"https://opendata.stif.info/explore/dataset/referentiel-arret-tc-idf/download/?format=csv&timezone=Europe/Berlin&use_labels_for_header=true"),
             separator = ";"),
         Load("ZDEr_X_Y", "ZDEr_X_Y", srid = 2154,
             select = {"ZDEr_LIBELLE_TYPE_ARRET": select},
             xFunction = lambda x: x.split(",")[0],
             yFunction = lambda y: y.split(",")[1]),
         Mapping(
             select = Select(
                 types = ["nodes", "ways"],
                 tags = osmTags),
             osmRef = "ref:FR:STIF",
             conflationDistance = conflationDistance,
             generate = Generate(
                 static1 = defaultTag,
                 static2 = {"source": self.source},
                 mapping1 = {"ref:FR:STIF": "ZDEr_ID_REF_A"},
                 mapping2 = {"name": "ZDEr_NOM"},
                 text = lambda tags, fields: {"en": u"STIF public transport stop of %s" % tags["name"], "fr": u"Arrêt de transport d'Île-de-France de %s" % tags["name"]} )))
예제 #13
0
    def __init__(self, config, logger = None):
        self.missing_official = {"item":"8025", "class": 1, "level": 3, "tag": ["merge", "post"], "desc": T_(u"Post box not integrated") }
        self.missing_osm      = {"item":"7051", "class": 2, "level": 3, "tag": ["merge", "post"], "desc": T_(u"Post box without ref") }
        self.possible_merge   = {"item":"8026", "class": 3, "level": 3, "tag": ["merge", "post"], "desc": T_(u"Post box, integration suggestion") }

        Analyser_Merge.__init__(self, config, logger,
            "http://datanova.legroupe.laposte.fr/explore/dataset/laposte_boiterue",
            u"Liste des boîtes aux lettres de rue France métropolitaine et DOM",
            CSV(Source(attribution = u"data.gouv.fr:LaPoste", millesime = "05/2016",
                    fileUrl = "http://datanova.legroupe.laposte.fr/explore/dataset/laposte_boiterue/download/?format=csv&use_labels_for_header=true"),
                separator = ";"),
            Load("Latlong", "Latlong",
                xFunction = lambda x: x and x.split(',')[1],
                yFunction = lambda y: y and y.split(',')[0]),
            Mapping(
                select = Select(
                    types = ["nodes"],
                    tags = {"amenity": "post_box"}),
                osmRef = "ref",
                conflationDistance = 50,
                generate = Generate(
                    missing_official_fix = False,
                    static1 = {
                        "amenity": "post_box",
                        "operator": "La Poste"},
                    static2 = {"source": self.source},
                    mapping1 = {"ref": "CO_MUP"},
                text = lambda tags, fields: {"en": ", ".join(filter(lambda x: x and x != 'None' and x != '', [fields[u"VA_NO_VOIE"], fields[u"LB_EXTENSION"].strip(), fields[u"LB_VOIE_EXT"], fields["CO_POSTAL"], fields[u"LB_COM"]]))} )))

#LB_TYPE_GEO
 def __init__(self, config, logger, clas, select, osmTags, defaultTag):
     self.missing_official = {"item":"8040", "class": 1+10*clas, "level": 3, "tag": ["merge", "railway", "public transport"], "desc": T_(u"RATP station not integrated") }
     self.possible_merge   = {"item":"8041", "class": 3+10*clas, "level": 3, "tag": ["merge", "railway", "public transport"], "desc": T_(u"RATP station, integration suggestion") }
     Analyser_Merge.__init__(self, config, logger,
         "http://data.ratp.fr/fr/les-donnees/fiche-de-jeu-de-donnees/dataset/positions-geographiques-des-stations-du-reseau-ratp.html",
         u"Positions géographiques des stations du réseau RATP",
         CSV(Source(attribution = u"RATP", millesime = "07/2012",
                 file = "ratp_arret_graphique.csv.bz2"),
             separator = "#"),
         Load("lon", "lat",
             create = """
                 id VARCHAR(254),
                 lon VARCHAR(254),
                 lat VARCHAR(254),
                 nom_station VARCHAR(254),
                 ville_cp VARCHAR(254),
                 reseau VARCHAR(254)""",
             select = {"reseau": select}),
         Mapping(
             select = Select(
                 types = ["nodes", "ways"],
                 tags = osmTags),
             osmRef = "ref:FR:RATP",
             conflationDistance = 100,
             generate = Generate(
                 static1 = defaultTag,
                 static2 = {"source": self.source},
                 mapping1 = {"ref:FR:RATP": "id"},
                 mapping2 = {"name": "nom_station"},
                 text = lambda tags, fields: {"en": u"RATP station of %s" % tags["name"], "fr": u"Station RATP de %s" % tags["name"]} )))
예제 #15
0
    def __init__(self, config, logger = None):
        self.missing_official = {"item":"8270", "class": 1, "level": 3, "tag": ["merge", "power"], "desc": T_(u"Power generator not integrated") }
        self.missing_osm      = {"item":"7180", "class": 2, "level": 3, "tag": ["merge", "power"], "desc": T_(u"Power generator without ref:FR:RTE") }
        self.possible_merge   = {"item":"8271", "class": 3, "level": 3, "tag": ["merge", "power"], "desc": T_(u"Power generator, integration suggestion") }
        self.update_official  = {"item":"8272", "class": 4, "level": 3, "tag": ["merge", "power"], "desc": T_(u"Power generator update") }

        Analyser_Merge.__init__(self, config, logger,
            "https://opendata.rte-france.com/explore/dataset/registre_parc_prod_rpt",
            u"Registre 2015 des installations de production raccordées au Réseau de Transport d'Electricité",
            CSV(Source(attribution = u"data.gouv.fr:RTE", millesime = "2015",
                    fileUrl = "https://opendata.rte-france.com/explore/dataset/registre_parc_prod_rpt/download/?format=csv&timezone=Europe/Berlin&use_labels_for_header=true"),
                separator = ";"),
            Load("Geo-point IRIS", "Geo-point IRIS",
                xFunction = lambda x: x and x.split(',')[1],
                yFunction = lambda y: y and y.split(',')[0]),
            Mapping(
                select = Select(
                    types = ["ways"],
                    tags = {"power": "generator"}),
                conflationDistance = 5000,
                generate = Generate(
                    static1 = {
                        "power": "generator"},
                    static2 = {"source": self.source},
                    mapping1 = {
                        "ref:FR:RTE": "Identifiant",
                        "voltage": lambda fields: (int(float(fields["Tension (kV)"]) * 1000)) if fields.get("Tension (kV)") and fields["Tension (kV)"] != "<45" else None,
                        "generator:source": lambda fields: self.filiere[fields["Filière"]][fields["Combustible"]],
                        "generator:output:electricity": lambda fields: (int(float(fields["Puissance maximale (MW)"]) * 1000000)) if fields.get("Puissance maximale (MW)") else None},
                    mapping2 = {
                        "start": lambda fields: fields[u"Date de mise en service"][0:4] if fields[u"Date de mise en service"].endswith('-01-01') or fields[u"Date de mise en service"].endswith('-12-31') else fields[u"Date de mise en service"],
                        "operator": "Exploitant"},
                   tag_keep_multiple_values = ["voltage"],
                   text = lambda tags, fields: T_(u"Power substation of %s", fields["Site de production"]))))
예제 #16
0
 def __init__(self, config, logger, level, desc, osmTags, osmTypes, c, tcd,
              stcd, threshold):
     self.missing_official = {
         "item": "7110",
         "class": tcd * 100 + stcd,
         "level": level,
         "tag": ["merge", "highway"],
         "desc": desc
     }
     Analyser_Merge.__init__(
         self, config, logger,
         "http://diffusion-numerique.info-routiere.gouv.fr/tables-alert-c-a4.html",
         "Alert-C-point",
         CSV(Source(
             fileUrl=
             "http://diffusion-numerique.info-routiere.gouv.fr/IMG/zip/Cederom_Alert-C_v11-0.zip",
             zip="Data/Mff/POINTS.DAT"),
             separator=";"),
         Load("XCOORD",
              "YCOORD",
              xFunction=lambda x: float(x) / 100000,
              yFunction=lambda y: float(y) / 100000,
              where=lambda res: res["CLASS"] == c and res["TCD"] == str(tcd)
              and res["STCD"] == str(stcd)),
         Mapping(select=Select(types=osmTypes, tags=osmTags),
                 conflationDistance=threshold))
예제 #17
0
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "8040",
         "class": 41,
         "level": 3,
         "tag": ["merge", "public transport"],
         "desc": T_(u"TransGironde stop not integrated")
     }
     self.possible_merge = {
         "item": "8041",
         "class": 43,
         "level": 3,
         "tag": ["merge", "public transport"],
         "desc": T_(u"TransGironde stop, integration suggestion")
     }
     self.update_official = {
         "item": "8042",
         "class": 44,
         "level": 3,
         "tag": ["merge", "public transport"],
         "desc": T_(u"TransGironde stop update")
     }
     Analyser_Merge.__init__(
         self, config, logger,
         "http://catalogue.datalocale.fr/dataset/liste-lignereguliere-transgironde",
         u"Horaires des lignes régulières du réseau transgironde",
         CSV(
             Source(
                 attribution=u"Conseil général de la Gironde",
                 millesime="12/2015",
                 fileUrl=
                 "http://catalogue.datalocale.fr/storage/f/2015-12-07T101339/ExportGTFS_30-11-15.zip",
                 zip="Export GTFS au 30-11-15/stops.txt")),
         Load("stop_lon", "stop_lat"),
         Mapping(
             select=Select(types=["nodes", "ways"],
                           tags={"highway": "bus_stop"}),
             osmRef="ref:FR:TransGironde",
             conflationDistance=100,
             generate=Generate(
                 static1={
                     "highway": "bus_stop",
                     "public_transport": "stop_position",
                     "bus": "yes",
                     "network": "TransGironde"
                 },
                 static2={"source": self.source},
                 mapping1={
                     "ref:FR:TransGironde":
                     lambda res: res["stop_id"].split(':')[1],
                     "name":
                     lambda res: res['stop_name'].split(' - ')[1]
                     if len(res['stop_name'].split(' - ')) > 1 else None
                 },
                 text=lambda tags, fields: {
                     "en": u"TransGironde stop of %s" % fields["stop_name"],
                     "fr": u"Arrêt TransGironde de %s" % fields["stop_name"]
                 })))
    def __init__(self,
                 config,
                 classs,
                 desc,
                 wikiTypes,
                 wikiCountry,
                 wikiLang,
                 starts,
                 osmTags,
                 osmTypes,
                 conflationDistance,
                 logger=None):
        self.possible_merge = {
            "item": "8101",
            "class": classs,
            "level": 3,
            "tag": ["merge", "wikipedia"],
            "desc": desc
        }
        Analyser_Merge.__init__(
            self, config, logger,
            "http://toolserver.org/~kolossos/wp-world/pg-dumps/wp-world/",
            "Wikipedia-World",
            CSV(Source(file="wikipedia_point_fr.csv.bz2"),
                csv=False,
                separator=None,
                null=None),
            Load(("ST_X(the_geom)", ), ("ST_Y(the_geom)", ),
                 create=self.create_table,
                 select={
                     "lang": wikiLang,
                     "Country": wikiCountry
                 },
                 where=(lambda res: not res["titel"].startswith("Liste "))
                 if starts == None else
                 (lambda res: res["titel"].startswith(starts))),
            Mapping(select=Select(types=osmTypes, tags={"name": None}),
                    osmRef="wikipedia",
                    conflationDistance=conflationDistance,
                    generate=Generate(mapping1={
                        "wikipedia":
                        lambda fields: fields["lang"] + ":" + fields["titel"]
                    },
                                      text=lambda tags, fields:
                                      {fields["lang"]: fields["titel"]})))

        if wikiTypes != None:
            self.load.select[
                "types"] = wikiTypes  # http://en.wikipedia.org/wiki/Wikipedia:GEO#type:T

        if isinstance(osmTags, dict):
            self.mapping.select.tags[0].update(osmTags)
        else:
            for t in osmTags:
                t.update(self.osmTags)
            self.mapping.select.tags = osmTags
예제 #19
0
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "2042",
         "class": 31,
         "level": 3,
         "tag": ["missing_official", "recycling"],
         "desc": T_(u"SITCOM recycling not integrated")
     }
     self.possible_merge = {
         "item": "2044",
         "class": 33,
         "level": 3,
         "tag": ["possible_merge", "recycling"],
         "desc": T_(u"SITCOM recycling, integration suggestion")
     }
     self.update_official = {
         "item": "2045",
         "class": 34,
         "level": 3,
         "tag": ["update_official", "recycling"],
         "desc": T_(u"SITCOM recycling update")
     }
     Analyser_Merge.__init__(
         self,
         config,
         logger,
         "http://www.sitcom40.fr/",
         u"Emplacements d'apport volontaire",
         CSV(
             Source(attribution=u"Sitcom Côte Sud Landes",
                    millesime="07/2017",
                    file="recycling_FR_sitcom.csv.bz2")),
         Load(
             "Y",
             "X",  # lat/lon inverted
             xFunction=self.float_comma,
             yFunction=self.float_comma),
         Mapping(
             select=Select(types=["nodes", "ways"],
                           tags={
                               "amenity": "recycling",
                               "recycling_type": "container"
                           }),
             osmRef="ref:FR:SITCOM",
             conflationDistance=200,
             generate=Generate(
                 static1={
                     "amenity": "recycling",
                     "recycling_type": "container"
                 },
                 static2={"source": self.source},
                 mapping1={"ref:FR:SITCOM": "Cle"},
                 text=lambda tags, fields: {"en": fields["Nom du point"]})))
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "8040",
         "class": 61,
         "level": 3,
         "tag": ["merge", "public transport"],
         "desc": T_(u"CG71 stop not integrated")
     }
     self.possible_merge = {
         "item": "8041",
         "class": 63,
         "level": 3,
         "tag": ["merge", "public transport"],
         "desc": T_(u"CG71 stop, integration suggestion")
     }
     Analyser_Merge.__init__(
         self, config, logger,
         "http://www.opendata71.fr/thematiques/transport/localisation-des-points-d-arret-de-bus",
         u"Localisation des arrêts de bus et car - CG71",
         CSV(
             Source(
                 attribution=
                 u"Conseil général de la Saône-et-Loire - Direction des Transports et de l'intermodalité",
                 millesime="02/2015",
                 fileUrl=
                 "http://opendata71interactive.cloudapp.net/DataBrowser/DownloadCsv?container=dataviz&entitySet=CG71DTIPointsArret&filter=NOFILTER"
             )),
         Load("latitude",
              "longitude",
              xFunction=self.float_comma,
              yFunction=self.float_comma),
         Mapping(select=Select(types=["nodes", "ways"],
                               tags={"highway": "bus_stop"}),
                 osmRef="ref:FR:CG71",
                 conflationDistance=100,
                 generate=Generate(
                     static1={
                         "highway": "bus_stop",
                         "public_transport": "stop_position",
                         "bus": "yes"
                     },
                     static2={"source": self.source},
                     mapping1={"ref:FR:CG71": "cod_arret"},
                     mapping2={
                         "name":
                         lambda res: res['nom'].split(' - ')[1].strip()
                         if ' - ' in res['nom'] else res['nom'].strip()
                     },
                     text=lambda tags, fields: {
                         "en": u"CG71 stop of %s" % fields["nom"].strip(),
                         "fr": u"Arrêt CG71 de %s" % fields["nom"].strip()
                     })))
    def __init__(self, config, logger = None):
        self.missing_official = {"item":"8020", "class": 1, "level": 3, "tag": ["merge", "post"], "desc": T_(u"Post office not integrated") }
        self.missing_osm      = {"item":"7050", "class": 2, "level": 3, "tag": ["merge", "post"], "desc": T_(u"Post office without ref:FR:LaPoste") }
        self.possible_merge   = {"item":"8021", "class": 3, "level": 3, "tag": ["merge", "post"], "desc": T_(u"Post office, integration suggestion") }
        self.update_official  = {"item":"8022", "class": 4, "level": 3, "tag": ["merge", "post"], "desc": T_(u"Post office update") }

        self.Annexe = re.compile(' A$')
        self.Principal = re.compile(' PAL$')
        self.APBP = re.compile(' (AP|BP)$')

        Analyser_Merge.__init__(self, config, logger,
            "https://www.data.gouv.fr/fr/datasets/liste-des-points-de-contact-du-reseau-postal-francais-et-horaires",
            u"Liste des points de contact du réseau postal français et horaires",
            CSV(Source(attribution = u"data.gouv.fr:LaPoste", millesime = "06/2015",
                    file = "poste_FR.csv.bz2", encoding = "ISO-8859-15"),
                separator = ";"),
            Load("Longitude", "Latitude"),
            Mapping(
                select = Select(
                    types = ["nodes", "ways"],
                    tags = {"amenity": "post_office"}),
                osmRef = "ref:FR:LaPoste",
                conflationDistance = 1000,
                generate = Generate(
                    static1 = {
                        "amenity": "post_office",
                        "operator": "La Poste"},
                    static2 = {"source": self.source},
                    mapping1 = {
                        "ref:FR:LaPoste": "#Identifiant",
                        "post_office:type": lambda res: {
                            None: None,
                            u"Bureau de poste": None,
                            u"Agence postale commnunale": "post_annex",
                            u"Relais poste commerçant": "post_partner"
                        }[res["Caractéristique_du_site"]],
                        "addr:postcode": "Code_postal",
                        # localite
                        # pays
                        "copy_facility": lambda res: self.bool[res["Photocopie"]],
                        "atm": lambda res: self.bool[res["Distributeur_de_billets"]],
                        "stamping_machine": lambda res: self.bool[res["Affranchissement_Libre_Service"]],
                        "wheelchair": lambda res:
                            "yes" if self.bool[res["Accessibilité_Absence_de_ressaut_de_plus_de_2_cm_de_haut"]] and self.bool[res["Accessibilité_Entrée_autonome_en_fauteuil_roulant_possible"]] else
                            "limited" if self.bool[res["Accessibilité_Absence_de_ressaut_de_plus_de_2_cm_de_haut"]] or self.bool[res["Accessibilité_Entrée_autonome_en_fauteuil_roulant_possible"]] else
                            "no"},
                    mapping2 = {
                        "name": lambda res: re.sub(self.Principal, " Principal", re.sub(self.Annexe, " Annexe", re.sub(self.APBP, "", res["Libellé_du_site"]))),
                        "change_machine": lambda res: self.bool[res["Changeur_de_monnaie"]],
                        "phone": "Numéro_de_téléphone"},
                text = lambda tags, fields: {"en": u"Post office %s" % ", ".join(filter(lambda x: x and x!='None', [fields[u"Précision_du_géocodage"].lower(), fields[u"Adresse"], fields[u"Complément_d_adresse"], fields[u"Lieu_dit"], fields["Code postal"], fields[u"Localité"]]))} )))
    def __init__(self, config, logger=None):
        self.missing_osm = {
            "item": "7160",
            "class": 2,
            "level": 3,
            "tag": ["merge", "post"],
            "desc": T_(u"admin_level 8 without addr:postcode")
        }
        self.possible_merge = {
            "item": "8221",
            "class": 3,
            "level": 3,
            "tag": ["merge", "post"],
            "desc": T_(u"Postal code, integration suggestion")
        }

        Analyser_Merge.__init__(
            self, config, logger,
            "https://datanova.legroupe.laposte.fr/explore/dataset/laposte_hexasmal",
            u"Base officielle des codes postaux",
            CSV(Source(
                attribution=u"La Poste",
                millesime="12/2014",
                fileUrl=
                "https://datanova.legroupe.laposte.fr/explore/dataset/laposte_hexasmal/download/?format=csv&use_labels_for_header=true"
            ),
                separator=";"), Load(srid=None),
            Mapping(select=Select(types=["relations"],
                                  tags={
                                      "type": "boundary",
                                      "admin_level": "8",
                                      "ref:INSEE": None
                                  }),
                    osmRef="addr:postcode",
                    extraJoin="ref:INSEE",
                    generate=Generate(
                        static2={"source:postal_code": self.source},
                        mapping1={
                            "ref:INSEE": "Code_commune_INSEE",
                            "addr:postcode": "Code_postal"
                        },
                        text=lambda tags, fields: {
                            "en":
                            u"Postal code %s for %s (INSEE:%s)" %
                            (fields["Code_postal"],
                             (fields["Nom_commune"] or "").strip(), fields[
                                 "Code_commune_INSEE"])
                        })))
 def __init__(self, config, logger = None):
     self.missing_official = {"item":"9982", "class": 2, "level": 3, "tag": ["missing_official"], "desc": T_(u"Misc not integrated") }
     Analyser_Merge.__init__(self, config, logger,
         "https://www.data.gouv.fr/fr/datasets/58e5924b88ee3802ca255566/",
         u"PCI Vecteur (Plan Cadastral Informatisé) - Point_id",
         CSV(Source(attribution = u"Ministère de l’Economie et des Finances", millesime = "10/2017", file = "cadastre_TPOINT_id_clean.csv.bz2")),
         Load("X", "Y",
             select = {"tex": "%borne incendie%"}),
         Mapping(
             select = Select(
                 types = ["nodes"],
                 tags = {"emergency": "ire_hydrant"}),
             conflationDistance = 200,
             generate = Generate(
                 static1 = {"emergency": "fire_hydrant"},
                 static2 = {"source": self.source},
             text = lambda tags, fields: {"en": u"%s, confidence: %s" % (fields["tex"], 1)} )))
예제 #24
0
 def __init__(self, config, logger=None):
     _Analyser_Merge_Street_Number.__init__(
         self, config, 2, "Nantes", logger,
         "http://data.nantes.fr/donnees/detail/adresses-postales-de-nantes-metropole/",
         u"Adresses postales de Nantes Métropole",
         CSV(
             Source(
                 attribution=u"Nantes Métropole %s",
                 millesime="03/2016",
                 fileUrl=
                 "http://data.nantes.fr/fileadmin/data/datastore/nm/urbanisme/24440040400129_NM_NM_00001/ADRESSES_NM_csv.zip",
                 zip="ADRESSES_NM.csv",
                 encoding="utf-8-sig")), Load("LONG_WGS84", "LAT_WGS84"),
         Mapping(generate=Generate(
             static2={"source": self.source},
             mapping1={"addr:housenumber": "NUMERO"},
             text=lambda tags, fields: {"en": fields["ADRESSE"]})))
예제 #25
0
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "8030",
         "class": 100,
         "level": 3,
         "tag": ["merge", "railway"],
         "desc": T_(u"College not integrated")
     }
     Analyser_Merge.__init__(
         self, config, logger, "http://www.data.gouv.fr/DataSet/30382046",
         u"Etablissements d'enseignement supérieur",
         CSV(
             Source(
                 attribution=
                 u"data.gouv.fr:Office national d'information sur les enseignements et les professions",
                 millesime="11/2011",
                 file="college_FR.csv.bz2")),
         Load("GPS_Y",
              "GPS_X",
              xFunction=self.float_comma,
              yFunction=self.float_comma),
         Mapping(select=Select(types=["nodes", "ways", "relations"],
                               tags={"amenity": ["college", "university"]}),
                 conflationDistance=50,
                 generate=Generate(
                     static1={"amenity": "college"},
                     static2={"source": self.source},
                     mapping1={
                         "operator:type":
                         lambda res: "private"
                         if res["STATUT_ETABLISSEMENT"] in [
                             u"CFA privé", u"Privé hors contrat",
                             u"Privé reconnu", u"Privé sous contrat"
                         ] else None,
                         "short_name":
                         "SIGLE_ETABLISSEMENT"
                     },
                     mapping2={"name": "NOM_ETABLISSEMENT"},
                     text=lambda tags, fields: {
                         "en":
                         " - ".join(
                             filter(lambda i: i != "None", [
                                 fields["SIGLE_ETABLISSEMENT"], fields[
                                     "NOM_ETABLISSEMENT"]
                             ]))
                     })))
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "8130",
         "class": 1,
         "level": 3,
         "tag": ["merge", "parking"],
         "desc": T_(u"CAPP parking not integrated")
     }
     Analyser_Merge.__init__(
         self, config, logger,
         "http://opendata.agglo-pau.fr/index.php/fiche?idQ=18",
         u"Parkings sur la CAPP",
         CSV(
             Source(attribution=u"Communauté d'Agglomération Pau-Pyrénées",
                    millesime="01/2013",
                    fileUrl=
                    "http://opendata.agglo-pau.fr/sc/call.php?f=1&idf=18",
                    zip="Parking_WGS84.csv",
                    encoding="ISO-8859-15")),
         Load("X",
              "Y",
              xFunction=self.float_comma,
              yFunction=self.float_comma),
         Mapping(select=Select(types=["nodes", "ways"],
                               tags={"amenity": "parking"}),
                 conflationDistance=200,
                 generate=Generate(
                     static1={"amenity": "parking"},
                     static2={"source": self.source},
                     mapping1={
                         "name":
                         "NOM",
                         "fee":
                         lambda res: "yes"
                         if res["Pay_grat"] == "Payant" else "no",
                         "capacity":
                         lambda res: res["Places"]
                         if res["Places"] != "0" else None,
                         "parking":
                         lambda res: "surface"
                         if res["Ouvrage"] == "Plein air" else "underground"
                         if res["Ouvrage"] == "Souterrain" else None
                     },
                     text=lambda tags, fields:
                     {"en": u"Parking %s" % tags["name"]})))
예제 #27
0
    def __init__(self, config, logger = None):
        self.missing_official = {"item":"8010", "class": 1, "level": 3, "tag": ["merge", "building"], "desc": T_(u"Historical monument not integrated") }
        self.missing_osm      = {"item":"7080", "class": 2, "level": 3, "tag": ["merge"], "desc": T_(u"Historical monument without ref:mhs or invalid") }
        self.possible_merge   = {"item":"8011", "class": 3, "level": 3, "tag": ["merge"], "desc": T_(u"Historical monument, integration suggestion") }
        self.update_official  = {"item":"8012", "class": 4, "level": 3, "tag": ["merge"], "desc": T_(u"Historical monument update") }

        def parseDPRO(dpro):
            ret = None;
            # Match YYYY ou YYYY/MM ou YYYY/MM/DD
            match = re.match("^(\d{4}(?:/\d{2}(?:/\d{2})?)?) :", dpro);
            if match:
                ret = match.group(1).replace("/", "-");
            return ret;

        Analyser_Merge.__init__(self, config, logger,
            "https://www.data.gouv.fr/fr/datasets/monuments-historiques-liste-des-immeubles-proteges-au-titre-des-monuments-historiques/",
            u"Monuments Historiques : liste des Immeubles protégés au titre des Monuments Historiques",
#            CSV(Source(fileUrl = "http://data.culture.fr/entrepot/MERIMEE/merimee-MH.csv.zip", zip = "merimee-MH-valid.csv.utf"),
#            Original without location, geocoded with http://adresse.data.gouv.fr/csv/
            CSV(Source(attribution = u"data.gouv.fr:Ministère de la Culture", millesime = "04/2015",
                    file = "heritage_FR_merimee.csv.bz2"),
                separator = '|'),
            Load("longitude", "latitude",
                select = {"DPRO": True}),
            Mapping(
                select = Select(
                    types = ["nodes", "ways", "relations"],
                    tags = {
#                        "heritage": ["1", "2", "3"],
                        "heritage:operator": None}),
                osmRef = "ref:mhs",
                conflationDistance = 1000,
                generate = Generate(
                    static1 = {"heritage:operator": "mhs"},
                    static2 = {"source:heritage": self.source},
                    mapping1 = {
                        "ref:mhs": "REF",
                        "mhs:inscription_date": lambda res: parseDPRO(res["DPRO"]),
                        "heritage": lambda res: 2 if u"classement par arrêté" in res["PPRO"] else 3 if u"inscription par arrêté" in res["PPRO"] else None},
                    mapping2 = {"name": "TICO"},
                    tag_keep_multiple_values = ["heritage:operator"],
                    text = lambda tags, fields: {"en": u"Historical monument: %s (positioned at %s with confidence %s)" % (", ".join(filter(lambda x: x!= None and x != "", [fields["DPRO"], fields["ADRS"], fields["COM"]])), fields["result_type"], fields["result_score"])} )))
예제 #28
0
 def __init__(self, config, logger=None):
     _Analyser_Merge_Street_Number.__init__(
         self,
         config,
         5,
         "Montpellier",
         logger,
         "http://opendata.montpelliernumerique.fr/Point-adresse",
         u"Ville de Montpellier - Point adresse",
         # Convert shp with QGis, save as CSV with layer "GEOMETRY=AS_XY".
         CSV(
             Source(attribution=u"Ville de Montpellier",
                    millesime="05/2016",
                    file="address_france_montpellier.csv.bz2")),
         Load("X", "Y", srid=2154, where=lambda res: res["NUM_VOI"] != "0"),
         Mapping(generate=Generate(
             static2={"source": self.source},
             mapping1={"addr:housenumber": "NUM_SUF"},
             text=lambda tags, fields:
             {"en": u"%s %s" % (fields["NUM_SUF"], fields["LIB_OFF"])})))
예제 #29
0
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "8180",
         "class": 1,
         "level": 3,
         "tag": ["merge", "public equipment"],
         "desc": T_(u"Bordeaux toilets not integrated")
     }
     Analyser_Merge.__init__(
         self, config, logger,
         "http://opendata.bordeaux.fr/content/toilettes-publiques",
         u"Toilettes publiques",
         CSV(Source(
             attribution=u"Ville de Bordeaux",
             millesime="01/2016",
             fileUrl=
             "http://opendatabdx.cloudapp.net/DataBrowser/DownloadCsv?container=databordeaux&entitySet=sigsanitaire&filter=NOFILTER"
         ),
             separator=";"),
         Load("X_LONG",
              "Y_LAT",
              xFunction=self.float_comma,
              yFunction=self.float_comma),
         Mapping(select=Select(types=["nodes", "ways"],
                               tags={"amenity": "toilets"}),
                 conflationDistance=100,
                 generate=Generate(
                     static1={
                         "amenity": "toilets",
                         "fee": "no",
                         "access": "public"
                     },
                     static2={"source": self.source},
                     mapping1={
                         "toilets:wheelchair":
                         lambda res: "yes"
                         if res["OPTIONS"] == u"Handicapé" else None,
                         "toilets:position":
                         lambda res: "urinal"
                         if res["TYPOLOGIE"] == u"Urinoir" else None
                     })))
 def __init__(self, config, logger=None):
     self.missing_official = {
         "item": "8160",
         "class": 11,
         "level": 3,
         "tag": ["merge", "public equipment", "cycle"],
         "desc": T_(u"CAPP bicycle rental not integrated")
     }
     Analyser_Merge.__init__(
         self, config, logger,
         "http://opendata.agglo-pau.fr/index.php/fiche?idQ=14",
         u"Stations Idécycle du réseau Idelis sur la CAPP",
         CSV(
             Source(attribution=u"Communauté d'Agglomération Pau-Pyrénées",
                    millesime="01/2013",
                    fileUrl=
                    "http://opendata.agglo-pau.fr/sc/call.php?f=1&idf=14",
                    zip="Idecycl_WGS84.csv",
                    filter=lambda t: t.replace("\0", ""))),
         Load("X",
              "Y",
              xFunction=self.float_comma,
              yFunction=self.float_comma),
         Mapping(select=Select(types=["nodes"],
                               tags={"amenity": "bicycle_rental"}),
                 conflationDistance=100,
                 generate=Generate(
                     static1={
                         "amenity": "bicycle_rental",
                         "operator": "IDEcycle"
                     },
                     static2={"source": self.source},
                     mapping1={
                         "name":
                         "NOM",
                         "capacity":
                         "Nb_velo",
                         "vending":
                         lambda res: "subscription"
                         if res["Borne_pai"] == "Oui" else None
                     })))