Changeset 62a52a79 in osmose-backend


Ignore:
Timestamp:
Sep 29, 2014 7:57:38 PM (5 years ago)
Author:
Frédéric Rodrigo <fred.rodrigo@…>
Branches:
master
Children:
ce489c5
Parents:
5bfd8b1
git-author:
Frédéric Rodrigo <fred.rodrigo@…> (28/09/2014 00:03:03)
git-committer:
Frédéric Rodrigo <fred.rodrigo@…> (29/09/2014 19:57:38)
Message:

Add bad link detection between to same highway type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • analysers/analyser_osmosis_highway_link.py

    r5bfd8b1 r62a52a79  
    5050        w1.tags->'highway' = links_ends.highway_link OR 
    5151        w1.tags->'highway' || '_link' = links_ends.highway_link 
    52     )) AS has_bad 
     52    )) AS has_bad, 
     53    links_ends.highway_link, 
     54    COUNT(*) AS nways, 
     55    max(w1.tags->'highway') AS highway_conn 
    5356FROM 
    5457    links_ends 
     
    6265    links_ends.id, 
    6366    links_ends.nid, 
     67    links_ends.highway_link, 
    6468    links_ends.linestring 
    6569""" 
    6670 
    6771sql21 = """ 
    68 CREATE INDEX links_conn_idx ON links_conn(id, nid); 
     72CREATE INDEX links_conn_idx ON links_conn(id); 
    6973""" 
    7074 
     
    101105""" 
    102106 
     107sql50 = """ 
     108SELECT 
     109    lc1.id, 
     110    ST_AsText(way_locate(lc1.linestring)), 
     111    CASE lc1.highway_conn LIKE '%_link' 
     112        WHEN TRUE THEN lc1.highway_conn 
     113        ELSE lc1.highway_conn || '_link' 
     114    END 
     115FROM 
     116    links_conn AS lc1 
     117    JOIN links_conn AS lc2 ON 
     118        lc1.id = lc2.id AND 
     119        lc1.nid < lc2.nid AND 
     120        ( -- Sides have the same highway type 
     121            lc1.highway_conn = lc2.highway_conn OR 
     122            lc1.highway_conn = (lc2.highway_conn || '_link') OR 
     123            (lc1.highway_conn || '_link') = lc2.highway_conn 
     124        ) 
     125WHERE 
     126    lc1.nways = 1 AND 
     127    lc2.nways = 1 AND 
     128    -- link and first side have not the same highway type 
     129    lc1.highway_link != lc1.highway_conn AND 
     130    lc1.highway_link != (lc1.highway_conn || '_link') AND 
     131    (lc1.highway_link || '_link') != lc1.highway_conn 
     132""" 
     133 
    103134class Analyser_Osmosis_Highway_Link(Analyser_Osmosis): 
    104135 
     
    107138        self.classs[1] = {"item":"1110", "level": 1, "tag": ["highway", "fix:chair"], "desc": T_(u"Bad *_link highway") } 
    108139        self.classs_change[2] = {"item":"1110", "level": 1, "tag": ["highway", "fix:imagery"], "desc": T_(u"Highway too long for a *_link") } 
     140        self.classs[3] = {"item":"1110", "level": 1, "tag": ["highway", "fix:chair"], "desc": T_(u"Bad *_link highway") } 
    109141        self.callback40 = lambda res: {"class":2, "data":[self.way_full, self.positionAsText]} 
    110142 
     
    114146        self.run(sql21) 
    115147        self.run(sql30, lambda res: {"class":1, "data":[self.way_full, self.positionAsText]} ) 
     148        self.run(sql50, lambda res: {"class":3, "data":[self.way_full, self.positionAsText], "fix": {"~": {"highway": res[2]}} }) 
    116149 
    117150    def analyser_osmosis_all(self): 
Note: See TracChangeset for help on using the changeset viewer.