Changeset 6185cd4 in osmose-backend


Ignore:
Timestamp:
Feb 17, 2013 9:50:24 PM (7 years ago)
Author:
Frédéric Rodrigo <frodrigo@…>
Branches:
master
Children:
60b339b, 3ca23bd
Parents:
1b999dc
Message:

Boundary bit alone detection to analyser_osmosis_boundary_administrative

File:
1 edited

Legend:

Unmodified
Added
Removed
  • analysers/analyser_osmosis_boundary_administrative.py

    rf6433d6 r6185cd4  
    146146""" 
    147147 
     148sql50 = """ 
     149CREATE TEMP TABLE boundary AS 
     150SELECT 
     151    id, 
     152    linestring 
     153FROM 
     154    {0}ways AS ways 
     155WHERE 
     156    tags?'boundary' AND 
     157    tags->'boundary' = 'administrative' 
     158""" 
     159 
     160sql51 = """ 
     161SELECT 
     162    ways.id, 
     163    ST_AsText(way_locate(ways.linestring)) 
     164FROM 
     165    boundary AS ways 
     166    LEFT JOIN relation_members ON 
     167        relation_members.member_type = 'W' AND 
     168        relation_members.member_id = ways.id 
     169WHERE 
     170    relation_members.member_id IS NULL 
     171""" 
     172 
     173sql52 = """ 
     174SELECT 
     175    ways.id, 
     176    ST_AsText(way_locate(ways.linestring)) 
     177FROM 
     178    boundary AS ways 
     179    JOIN relation_members ON 
     180        relation_members.member_type = 'W' AND 
     181        relation_members.member_id = ways.id 
     182    JOIN relations ON 
     183        relation_members.relation_id = relations.id 
     184GROUP BY 
     185    ways.id, 
     186    ways.linestring 
     187HAVING 
     188    NOT BOOL_OR(relations.tags?'boundary') 
     189""" 
     190 
    148191class Analyser_Osmosis_Boundary_Administrative(Analyser_Osmosis): 
    149192 
     
    153196        self.classs[101] = {"item":"6070", "level": 1, "tag": ["boundary", "place"], "desc":{"fr":"Nœud place hors de sa commune"} } 
    154197        self.classs[2] = {"item":"6060", "level": 1, "tag": ["boundary", "geom"], "desc":{"fr":"Intersection entre commune"} } 
     198        self.classs_change[3] = {"item":"6060", "level": 2, "tag": ["boundary", "geom"], "desc":{"fr":"Fragment de frontière isolé", "en":"Boundary bit alone"} } 
    155199        self.callback20 = lambda res: {"class":100, "data":[self.relation_full, self.relation_full, self.positionAsText]} 
    156200        self.callback30 = lambda res: {"class":101, "data":[self.node_full, self.relation_full, self.positionAsText]} 
    157201        self.callback40 = lambda res: {"class":2, "data":[self.relation_full, self.relation_full, self.positionAsText]} 
    158  
    159     def analyser_osmosis_all(self): 
     202        self.callback50 = lambda res: {"class":3, "data":[self.way_full, self.positionAsText]} 
     203 
     204    def analyser_osmosis(self): 
    160205        self.run(sql10) 
    161206        self.run(sql11) 
     
    166211        self.run(sql30, self.callback30) 
    167212        self.run(sql40, self.callback40) 
     213 
     214    def analyser_osmosis_all(self): 
     215        self.run(sql50.format("")) 
     216        self.run(sql51, self.callback50) 
     217        self.run(sql52, self.callback50) 
     218 
     219    def analyser_osmosis_touched(self): 
     220        self.run(sql50.format("touched_")) 
     221        self.run(sql51, self.callback50) 
     222        self.run(sql52, self.callback50) 
Note: See TracChangeset for help on using the changeset viewer.