Esempio n. 1
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, error_file, logger, classs, topic, osmTags, defaultTags):
     self.missing_official = {
         "item": "8170",
         "class": classs,
         "level": 3,
         "tag": ["merge", "leisure"],
         "desc": T_(u"Pitch not integrated %s", topic),
     }
     SubAnalyser_Merge_Dynamic.__init__(
         self,
         config,
         error_file,
         logger,
         "http://www.data.gouv.fr/fr/dataset/recensement-des-equipements-sportifs-espaces-et-sites-de-pratiques",
         u"Recensement des équipements sportifs, fiches équipements",
         CSV(
             Source(
                 attribution=u"data.gouv.fr:Le ministère des droits des femmes, de la ville, de la jeunesse et des sports",
                 millesime="11/2015",
                 fileUrl="https://www.data.gouv.fr/s/resources/recensement-des-equipements-sportifs-espaces-et-sites-de-pratiques/20160209-165648/20160209_RES_FichesEquipement.zip",
                 zip="20160209_RES_FichesEquipement.csv",
                 encoding="ISO-8859-15",
             ),
             separator=";",
         ),
         Load("EquGpsX", "EquGpsY", select={"EquipementTypeLib": topic}, where=lambda row: self.validLatLon(row)),
         Mapping(
             select=Select(types=["nodes", "ways", "relations"], tags=osmTags),
             conflationDistance=200,
             generate=Generate(
                 static1=dict(dict(**osmTags), **defaultTags),
                 static2={"source": self.source},
                 mapping1={"surface": self.surface},
                 text=lambda tags, fields: {
                     "en": ", ".join(
                         filter(
                             lambda i: i and i != "None",
                             [
                                 fields["EquipementTypeLib"],
                                 fields["InsNo"],
                                 fields["EquNom"],
                                 fields["EquNomBatiment"],
                             ],
                         )
                     )
                 },
             ),
         ),
     )
 def __init__(self, config, error_file, logger, classs, topic, osmTags, defaultTags):
     self.missing_official = {"item":"8170", "class": classs, "level": 3, "tag": ["merge", "leisure"], "desc": T_(u"Pitch not integrated %s", topic) }
     SubAnalyser_Merge_Dynamic.__init__(self, config, error_file, logger,
         "http://www.data.gouv.fr/fr/dataset/recensement-des-equipements-sportifs-espaces-et-sites-de-pratiques",
         u"Recensement des équipements sportifs, fiches équipements",
         CSV(Source(attribution = u"data.gouv.fr:Le ministère des droits des femmes, de la ville, de la jeunesse et des sports", millesime = "11/2015",
                 fileUrl = "https://www.data.gouv.fr/s/resources/recensement-des-equipements-sportifs-espaces-et-sites-de-pratiques/20160209-165648/20160209_RES_FichesEquipement.zip", zip = "20160209_RES_FichesEquipement.csv", encoding = "ISO-8859-15"),
             separator = ';'),
         Load("EquGpsX", "EquGpsY",
             select = {"EquipementTypeLib": topic},
             where = lambda row: self.validLatLon(row)),
         Mapping(
             select = Select(
                 types = ["nodes", "ways", "relations"],
                 tags = osmTags),
             conflationDistance = 200,
             generate = Generate(
                 static1 = dict(dict(**osmTags), **defaultTags),
                 static2 = {"source": self.source},
                 mapping1 = {"surface": self.surface},
             text = lambda tags, fields: {"en": ", ".join(filter(lambda i: i and i != "None", [fields["EquipementTypeLib"], fields["InsNo"], fields["EquNom"], fields["EquNomBatiment"]]))} )))
 def __init__(self, config, error_file, logger, classs, topic, osmTags, defaultTags):
     self.missing_official = {"item":"8170", "class": classs, "level": 3, "tag": ["merge", "leisure"], "desc": T_(u"Pitch not integrated %s", topic) }
     SubAnalyser_Merge_Dynamic.__init__(self, config, error_file, logger,
         Source(
             url = "http://www.data.gouv.fr/fr/dataset/recensement-des-equipements-sportifs-espaces-et-sites-de-pratiques",
             name = u"Recensement des équipements sportifs, fiches équipements",
             file = "pitch_FR.csv.bz2",
             encoding = "ISO-8859-15",
             csv = CSV(separator = ';')),
         Load("EquGpsX", "EquGpsY", table = "pitch_fr",
             select = {"EquipementTypeLib": topic},
             where = lambda row: self.validLatLon(row)),
         Mapping(
             select = Select(
                 types = ["nodes", "ways", "relations"],
                 tags = osmTags),
             conflationDistance = 200,
             generate = Generate(
                 static = dict(dict({"source": u"data.gouv.fr:Le ministère des droits des femmes, de la ville, de la jeunesse et des sports - 2014"},
                     **osmTags), **defaultTags),
                 mapping = {
                     "surface": self.surface
                 },
             text = lambda tags, fields: {"en": ", ".join(filter(lambda i: i and i != "None", [fields["EquipementTypeLib"], fields["InsNo"], fields["EquNom"], fields["EquNomBatiment"]]))} )))