Changeset e00d14f in osmose-backend


Ignore:
Timestamp:
Jan 22, 2013 10:07:03 PM (7 years ago)
Author:
Jocelyn Jaubert <jocelyn.jaubert@…>
Branches:
master
Children:
5c295c4
Parents:
69b4ed7
git-author:
Jocelyn Jaubert <jocelyn.jaubert@…> (20/01/2013 22:54:17)
git-committer:
Jocelyn Jaubert <jocelyn.jaubert@…> (22/01/2013 22:07:03)
Message:

Separate results for analyser_osmosis_way_approximate in different class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • analysers/analyser_osmosis_way_approximate.py

    rfeccd33 re00d14f  
    7777        ) 
    7878    )/2 AS d, 
    79     type 
     79    type, 
     80    {3} 
    8081FROM ( 
    8182    SELECT 
     
    8384        ST_Transform(linestring, 2154) AS linestring, 
    8485        generate_series(2, ST_NPoints(linestring)-1) AS index, 
    85         COALESCE(tags->'railway', tags->'waterway', tags->'highway') AS type 
     86        tags->'{1}' AS type 
    8687    FROM 
    8788        {0}ways AS ways 
    8889    WHERE 
    89         ( 
    90             (tags?'railway' AND tags->'railway' = 'rail') OR 
    91             (tags?'waterway' AND tags->'waterway' = 'river') OR 
    92             (tags?'highway' AND tags->'highway' IN ('motorway', 'trunk', 'primary', 'secondary')) 
    93         ) AND 
     90        tags?'{1}' AND tags->'{1}' IN ('{2}') AND 
    9491        ST_NPoints(linestring) >= 4 
    9592) AS foo 
     
    114111    def __init__(self, config, logger = None): 
    115112        Analyser_Osmosis.__init__(self, config, logger) 
    116         self.classs_change[1] = {"item":"1190", "level": 3, "tag": ["geom", "highway", "railway"], "desc":{"fr":"Chemin approximatif", "en":"Approximate way"} } 
    117         self.callback10 = lambda res: {"class":1, "subclass":abs(int(hash(res[3]))), "data":[self.way_full, self.positionAsText], "text": {"en": "%s discart from %sm" % (res[3], res[2]), "fr": "Flèche de %sm sur %s" % (res[2], res[3])}} 
     113        self.tags = ( (10, "railway", ("rail",)), 
     114                      (20, "waterway", ("river",)), 
     115                      (30, "highway", ("motorway", "trunk", "primary", "secondary")), 
     116                    ) 
     117        for t in self.tags: 
     118            self.classs_change[t[0]] = {"item":"1190", "level": 3, "tag": ["geom", "highway", "railway"], "desc":{"fr":"%s approximatif" % t[1], "en":"Approximate %s" % t[1]} } 
     119        self.callback10 = lambda res: {"class":res[4], "subclass":abs(int(hash(res[3]))), "data":[self.way_full, self.positionAsText], "text": {"en": "%s discart from %sm" % (res[3], res[2]), "fr": "Flèche de %sm sur %s" % (res[2], res[3])}} 
    118120 
    119121    def analyser_osmosis_all(self): 
    120122        self.run(sql10) 
    121123        self.run(sql11) 
    122         self.run(sql12.format(""), self.callback10) 
     124        for t in self.tags: 
     125            self.run(sql12.format("", t[1], "', '".join(t[2]), t[0]), self.callback10) 
    123126 
    124127    def analyser_osmosis_touched(self): 
    125128        self.run(sql10) 
    126129        self.run(sql11) 
    127         self.run(sql12.format("touched_"), self.callback10) 
     130        for t in self.tags: 
     131            self.run(sql12.format("", t[1], ", ".join(t[2]), t[0]), self.callback10) 
Note: See TracChangeset for help on using the changeset viewer.