17. Plugin : TagManquant_RondPoint class TagManquant_RondPoint(Plugin): err_102 = 3010 err_102_fr = u"Tag highway manquant sur junction=roundabout" err_102_en = u"Tag highway missing on junction=roundabout" def way(self, data, tags, nds): if u"junction" not in tags: return if u"highway" not in tags: return [(102, 0, {})]
18. Plugin : TagWatchWikipedia def init(self, logger): self.Wiki = re.compile(u"http://([^]+)wikipedia.+/(.+)") def node(self, data, tags): err = [] if "wikipedia" in tags: if tags["wikipedia"].startswith("http://"): m = self.Wiki.match(tags["wikipedia"]) if m: err.append((3031, 1, {"en": u"wikipedia=%s => wikipedia=%s:%s"})) else: err.append((3031, 0, {"en": u"Not a wikipedia URL"})) return err def way(self, data, tags, nds): return self.node(data, tags)
19. Analyseur osmosis def analyser(config, logger = None): gisconn = PgSQL.Connection(config.dbs) giscurs = gisconn.cursor() apiconn = OsmOsis.OsmOsis(config.dbs, config.dbp) outxml = OsmSax.OsmSaxWriter(open(config.dst, "w"), "UTF-8") ## output headers outxml.startDocument() outxml.startElement("analyser", {"timestamp": time.gmtime()}) outxml.startElement("class", {"id":"1", "item":"1040"}) outxml.Element("classtext", {"lang":"fr", "title":"Polygone invalide"}) outxml.endElement("class") giscurs.execute("SET search_path TO %s,public;" % config.dbp) giscurs.execute("SELECT id FROM ways") for res in giscurs.fetchall(): ## output data outxml.startElement("error", {"class":"1"}) outxml.WayCreate(apiconn.WayGet(res[0])) outxml.endElement("error") outxml.endElement("analyser") ## output footers outxml._out.close()