際際滷

際際滷Share a Scribd company logo
Osmose La d└tection automatique d¨anomalies Fr└d└ric Rodrigo <fred.rodrigo  gmail.com> La Cantine - Paris 07/10/2011 C (c)left 2011 - CC-BY-SA v3.0 @
Osmose Frontend Backends Plugin
JOSM
Backends Analyseurs
Fr└quence : une r└gion toutes les 2h Limit└ par les serveurs OSM 5/6
Nouveau serveur OSM 7/8 T└l└chargement des extracts Geofabrik
Analyseurs R└cup└ration de donn└es externes OpenStreetBugs, G└od└sie Analyseur SAX des .osm Plugins Bases osm2pgsql (deprecated) Requ┷tes GIS Bases osmosis Requ┷tes
Requ┷tes GIS
Analyseurs analyser()
Construit un fichier XML
Analyseur SAX : Plugins Passe tous les └l└ments du fichier .osm en revue

More Related Content

Osmose

  • 1. Osmose La d└tection automatique d¨anomalies Fr└d└ric Rodrigo <fred.rodrigo gmail.com> La Cantine - Paris 07/10/2011 C (c)left 2011 - CC-BY-SA v3.0 @
  • 5. Fr└quence : une r└gion toutes les 2h Limit└ par les serveurs OSM 5/6
  • 6. Nouveau serveur OSM 7/8 T└l└chargement des extracts Geofabrik
  • 7. Analyseurs R└cup└ration de donn└es externes OpenStreetBugs, G└od└sie Analyseur SAX des .osm Plugins Bases osm2pgsql (deprecated) Requ┷tes GIS Bases osmosis Requ┷tes
  • 11. Analyseur SAX : Plugins Passe tous les └l└ments du fichier .osm en revue
  • 12. Appelle les plugins pour chaque └l└ments
  • 13. Analyseur SAX : Plugins P└rim┬tre d¨application only_for = [&quot;FR&quot;] M└thodes init()
  • 15. way()
  • 16. relation() Retourne une message si erreur d└tect└
  • 17. Plugin : TagManquant_RondPoint class TagManquant_RondPoint(Plugin): err_102 = 3010 err_102_fr = u&quot;Tag highway manquant sur junction=roundabout&quot; err_102_en = u&quot;Tag highway missing on junction=roundabout&quot; def way(self, data, tags, nds): if u&quot;junction&quot; not in tags: return if u&quot;highway&quot; not in tags: return [(102, 0, {})]
  • 18. Plugin : TagWatchWikipedia def init(self, logger): self.Wiki = re.compile(u&quot;http://([^]+)wikipedia.+/(.+)&quot;) def node(self, data, tags): err = [] if &quot;wikipedia&quot; in tags: if tags[&quot;wikipedia&quot;].startswith(&quot;http://&quot;): m = self.Wiki.match(tags[&quot;wikipedia&quot;]) if m: err.append((3031, 1, {&quot;en&quot;: u&quot;wikipedia=%s => wikipedia=%s:%s&quot;})) else: err.append((3031, 0, {&quot;en&quot;: u&quot;Not a wikipedia URL&quot;})) 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, &quot;w&quot;), &quot;UTF-8&quot;) ## output headers outxml.startDocument() outxml.startElement(&quot;analyser&quot;, {&quot;timestamp&quot;: time.gmtime()}) outxml.startElement(&quot;class&quot;, {&quot;id&quot;:&quot;1&quot;, &quot;item&quot;:&quot;1040&quot;}) outxml.Element(&quot;classtext&quot;, {&quot;lang&quot;:&quot;fr&quot;, &quot;title&quot;:&quot;Polygone invalide&quot;}) outxml.endElement(&quot;class&quot;) giscurs.execute(&quot;SET search_path TO %s,public;&quot; % config.dbp) giscurs.execute(&quot;SELECT id FROM ways&quot;) for res in giscurs.fetchall(): ## output data outxml.startElement(&quot;error&quot;, {&quot;class&quot;:&quot;1&quot;}) outxml.WayCreate(apiconn.WayGet(res[0])) outxml.endElement(&quot;error&quot;) outxml.endElement(&quot;analyser&quot;) ## output footers outxml._out.close()
  • 20. R└sultat d'analyse <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <analyser timestamp=&quot;2011-09-26T20:20:55Z&quot;> <class item=&quot;7011&quot; id=&quot;1&quot;> <classtext lang=&quot;fr&quot; title=&quot;Monument historique&quot; /> </class> <error class=&quot;1&quot; subclass=&quot;7351311549282023996&quot;> <location lat=&quot;49.1182439431&quot; lon=&quot;6.17654968492&quot; /> <text lang=&quot;fr&quot; value=&quot;Manque monument historique name=Immeuble heritage=* (Inscrit); heritage:operator=mhs; ref:mhs=PA0010686 mhs:inscription_date=1947 (20 rue Ladoucette, Metz)&quot; /> </error>

Editor's Notes

  • #2: http://datenkueche.com/osmlive/