Changeset 1b999dc in osmose-backend


Ignore:
Timestamp:
Feb 17, 2013 7:51:18 PM (7 years ago)
Author:
Frédéric Rodrigo <frodrigo@…>
Branches:
master
Children:
6185cd4
Parents:
16fe5c3
Message:

Add relation support to analyser_osmosis_useless

File:
1 edited

Legend:

Unmodified
Added
Removed
  • analysers/analyser_osmosis_useless.py

    r87ea86a r1b999dc  
    3737WHERE 
    3838    array_length(akeys(delete(delete(delete(delete(nodes.tags, 'created_by'), 'source'), 'note:qadastre'), 'name')), 1) IS NULL 
    39 ; 
    4039""" 
    4140 
     
    5453    (member_role IS NULL OR member_role = '') AND 
    5554    array_length(akeys(delete(delete(delete(delete(ways.tags, 'created_by'), 'source'), 'note:qadastre'), 'name')), 1) IS NULL 
    56 ; 
     55""" 
     56 
     57sql30 = """ 
     58SELECT 
     59    relations.id, 
     60    relation_members.relation_id, 
     61    ST_AsText(relation_locate(id)) 
     62FROM 
     63    {0}relations AS relations 
     64    LEFT JOIN relation_members ON 
     65        member_id = id AND 
     66        member_type = 'R' 
     67    {1} 
     68WHERE 
     69    (member_role IS NULL OR member_role = '') AND 
     70    array_length(akeys(delete(delete(delete(delete(relations.tags, 'created_by'), 'source'), 'note:qadastre'), 'name')), 1) IS NULL 
    5771""" 
    5872 
     
    6377        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"} } 
    6478        self.classs_change[2] = {"item":"1140", "level": 3, "tag": [], "desc":{"fr":"Way sans tag ou rôle", "en":"Missing tag or role on way"} } 
     79        self.classs_change[3] = {"item":"1140", "level": 3, "tag": [], "desc":{"fr":"Relation sans tag ou rôle", "en":"Missing tag or role on relation"} } 
    6580        self.callback10 = lambda res: {"class":1, "data":[self.node_full, self.relation_full, self.positionAsText]} 
    6681        self.callback20 = lambda res: {"class":2, "data":[self.way_full, self.relation_full if res[1] else None, self.positionAsText]} 
     82        self.callback20 = lambda res: {"class":3, "data":[self.relation_full, self.relation_full if res[1] else None, self.positionAsText]} 
    6783 
    6884    def analyser_osmosis_all(self): 
    6985        self.run(sql10.format("", ""), self.callback10) 
    7086        self.run(sql20.format("", ""), self.callback20) 
     87        self.run(sql30.format("", ""), self.callback20) 
    7188 
    7289    def analyser_osmosis_touched(self): 
    7390        touched_relations = """ 
    74     JOIN touched_relations AS relations ON 
    75         relation_members.relation_id = relations.id 
     91    JOIN touched_relations ON 
     92        relation_members.relation_id = touched_relations.id 
    7693""" 
    7794        self.run(sql10.format("touched_", ""), self.callback10) 
     
    7996        self.run(sql20.format("touched_", ""), self.callback20) 
    8097        self.run(sql20.format("", touched_relations), self.callback20) 
     98        self.run(sql30.format("touched_", ""), self.callback30) 
     99        self.run(sql30.format("", touched_relations), self.callback30) 
Note: See TracChangeset for help on using the changeset viewer.