Changeset f8ca5b56 in osmose-backend


Ignore:
Timestamp:
Mar 5, 2013 11:08:44 PM (7 years ago)
Author:
Frédéric Rodrigo <frodrigo@…>
Branches:
master
Children:
5a136ea
Parents:
5c71d35
git-author:
Frédéric Rodrigo <frodrigo@…> (02/03/2013 11:46:19)
git-committer:
Frédéric Rodrigo <frodrigo@…> (05/03/2013 23:08:44)
Message:

Support multiple inputs tag in merge analysis (OR)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • analysers/Analyser_Merge.py

    r8600e49 rf8ca5b56  
    261261 
    262262    def analyser_osmosis(self): 
     263        if not isinstance(self.osmTags, list): 
     264            self.osmTags = [self.osmTags] 
     265 
    263266        data = False 
    264267        def setDataTrue(): 
     
    293296        typeGeom = {'n': 'geom', 'w': 'way_locate(linestring)', 'r': 'relation_locate(id)'} 
    294297        self.logger.log(u"Retrive OSM item") 
     298        where = "(" + (") OR (".join(map(lambda x: self.where(x), self.osmTags))) + ")" 
    295299        self.run("CREATE TABLE osm_item AS" + 
    296300            ("UNION".join( 
     
    311315                        %(geom)s IS NOT NULL AND 
    312316                        ST_SetSRID(ST_GeomFromText('%(bbox)s'), 4326) && %(geom)s AND 
    313                         %(where)s)""" % {"type":type[0], "ref":self.osmRef, "geom":typeGeom[type[0]], "from":type, "bbox":bbox, "where":self.where(self.osmTags)}, 
     317                        %(where)s)""" % {"type":type[0], "ref":self.osmRef, "geom":typeGeom[type[0]], "from":type, "bbox":bbox, "where":where}, 
    314318                    self.osmTypes 
    315319                ) 
     
    430434                        column[k] += 1 
    431435        column = sorted(column, key=column.get, reverse=True) 
    432         column = filter(lambda a: a!=self.osmRef and not a in self.osmTags, column) 
    433         column = [self.osmRef] + self.osmTags.keys() + column 
     436        column = filter(lambda a: a!=self.osmRef and not a in self.osmTags[0], column) 
     437        column = [self.osmRef] + self.osmTags[0].keys() + column 
    434438        file = bz2.BZ2File("%s/%s%s.csv.bz2" % (self.config.dst_dir, self.officialName, ext), "w") 
    435439        file.write("%s\n" % ','.join(head + column)) 
Note: See TracChangeset for help on using the changeset viewer.