Changeset 339536c in osmose-backend


Ignore:
Timestamp:
Jan 22, 2013 9:47:39 PM (7 years ago)
Author:
Frédéric Rodrigo <frodrigo@…>
Branches:
master
Children:
a910761
Parents:
b3dc267
Message:

Support diff mode into analyser_osmosis_useless

File:
1 edited

Legend:

Unmodified
Added
Removed
  • analysers/analyser_osmosis_useless.py

    rfeccd33 r339536c  
    2525sql10 = """ 
    2626SELECT 
    27     id, 
     27    nodes.id, 
    2828    relation_members.relation_id, 
    2929    ST_ASText(geom) 
    3030FROM 
    31     nodes AS nodes 
     31    {0}nodes AS nodes 
    3232    JOIN relation_members ON 
    3333        member_id = id AND 
    3434        member_type = 'N' AND 
    3535        member_role = '' 
     36    {1} 
    3637WHERE 
    37     array_length(akeys(delete(delete(delete(tags, 'created_by'), 'source'), 'note:qadastre')), 1) IS NULL 
     38    array_length(akeys(delete(delete(delete(nodes.tags, 'created_by'), 'source'), 'note:qadastre')), 1) IS NULL 
    3839; 
    3940""" 
     
    4142sql20 = """ 
    4243SELECT 
    43     id, 
     44    ways.id, 
    4445    relation_members.relation_id, 
    4546    ST_ASText(way_locate(linestring)) 
    4647FROM 
    47     ways 
     48    {0}ways AS ways 
    4849    LEFT JOIN relation_members ON 
    4950        member_id = id AND 
    5051        member_type = 'W' 
     52    {1} 
    5153WHERE 
    5254    (member_role IS NULL OR member_role = '') AND 
    53     array_length(akeys(delete(delete(delete(tags, 'created_by'), 'source'), 'note:qadastre')), 1) IS NULL 
     55    array_length(akeys(delete(delete(delete(ways.tags, 'created_by'), 'source'), 'note:qadastre')), 1) IS NULL 
    5456; 
    5557""" 
     
    5961    def __init__(self, config, logger = None): 
    6062        Analyser_Osmosis.__init__(self, config, logger) 
    61         self.classs[1] = {"item":"1140", "level": 3, "tag": [], "desc":{"fr":"Nœud sans tag ou rôle", "en":"Missing tag or role on node"} } 
    62         self.classs[2] = {"item":"1140", "level": 3, "tag": [], "desc":{"fr":"Way sans tag ou rôle", "en":"Missing tag or role on way"} } 
     63        self.classs_change[1] = {"item":"1140", "level": 3, "tag": [], "desc":{"fr":"Nœud sans tag ou rôle", "en":"Missing tag or role on node"} } 
     64        self.classs_change[2] = {"item":"1140", "level": 3, "tag": [], "desc":{"fr":"Way sans tag ou rôle", "en":"Missing tag or role on way"} } 
    6365        self.callback10 = lambda res: {"class":1, "data":[self.node_full, self.relation_full, self.positionAsText]} 
    6466        self.callback20 = lambda res: {"class":2, "data":[self.way_full, self.relation_full if res[1] else None, self.positionAsText]} 
    6567 
    66     def analyser_osmosis(self): 
    67         self.run(sql10, self.callback10) 
    68         self.run(sql20, self.callback20) 
     68    def analyser_osmosis_all(self): 
     69        self.run(sql10.format("", ""), self.callback10) 
     70        self.run(sql20.format("", ""), self.callback20) 
     71 
     72    def analyser_osmosis_touched(self): 
     73        touched_relations = """ 
     74    JOIN touched_relations AS relations ON 
     75        relation_members.relation_id = relations.id 
     76""" 
     77        self.run(sql10.format("touched_", ""), self.callback10) 
     78        self.run(sql10.format("", touched_relations), self.callback10) 
     79        self.run(sql20.format("touched_", ""), self.callback20) 
     80        self.run(sql20.format("", touched_relations), self.callback20) 
Note: See TracChangeset for help on using the changeset viewer.