Changeset b8d48c9 in osmose-backend


Ignore:
Timestamp:
Jan 5, 2013 8:37:54 PM (7 years ago)
Author:
Jocelyn Jaubert <jocelyn.jaubert@…>
Branches:
master
Children:
b2de46a, 89ddc0f, ff0d23d
Parents:
819aac7 (diff), 8600e49 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'frodrigo/master'

Location:
analysers
Files:
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • analysers/Analyser_Merge.py

    r39df6ae r8600e49  
    287287        giscurs.execute("SELECT ST_AsText(ST_Envelope(ST_Extent(geom::geometry))::geography) FROM official") 
    288288        bbox = giscurs.fetchone()[0] 
     289        if not bbox: 
     290            return # Stop, no data 
    289291        self.run(sql03) 
    290292 
     
    430432        column = filter(lambda a: a!=self.osmRef and not a in self.osmTags, column) 
    431433        column = [self.osmRef] + self.osmTags.keys() + column 
    432         file = open("%s/%s%s.csv" % (self.config.dst_dir, self.officialName, ext), "w") 
     434        file = bz2.BZ2File("%s/%s%s.csv.bz2" % (self.config.dst_dir, self.officialName, ext), "w") 
    433435        file.write("%s\n" % ','.join(head + column)) 
    434436        for r in row: 
  • analysers/analyser_merge_school_fr.py

    rae4f07b rabbd871  
    2525# https://gitorious.org/osm-hacks/osm-hacks/trees/master/etablissements-scolaires 
    2626 
    27 class Analyser_Merge_School_Fr(Analyser_Merge): 
     27class _Analyser_Merge_School_Fr(Analyser_Merge): 
    2828 
    2929    create_table = """ 
     
    6060        self.sourceX = "X" 
    6161        self.sourceY = "Y" 
    62         self.sourceSRID = "2154" 
    6362        self.defaultTag = { 
    6463            "amenity": "school", 
     
    9190                return v 
    9291        return res["lib_nature"] 
     92 
     93    # No overlaping bbox 
     94 
     95    def is_in_metropole(self, x, y): 
     96        return x > -357823.2365 and x < 1313632.3628 and y > 6037008.6939 and y < 7230727.3772 
     97 
     98    def is_in_guadeloupe(self, x, y): 
     99        return x > 627264 and x < 693664 and y > 1755023 and y < 1826414 
     100 
     101    def is_in_guyane(self, x, y): 
     102        return x > 166254.8015 and x < 653463.1459 and y > 238817.6898 and y < 1002848.2203 
     103 
     104    def is_in_reunion(self, x, y): 
     105        return x > 312514 and x < 379436 and y > 7634041 and y < 7693301 
     106 
     107    def is_in_martinique(self, x, y): 
     108        return x > 689211 and x < 735159 and y > 1591528 and y < 1646407 
     109 
     110 
     111class Analyser_Merge_School_Fr_Metropole(_Analyser_Merge_School_Fr): 
     112    def __init__(self, config, logger = None): 
     113        _Analyser_Merge_School_Fr.__init__(self, config, logger) 
     114        self.officialName += " - Métropole" 
     115        self.sourceWhere = lambda res: self.is_in_metropole(float(res[1]), float(res[2])) 
     116        self.sourceSRID = "2154" 
     117 
     118class Analyser_Merge_School_Fr_Guadeloupe(_Analyser_Merge_School_Fr): 
     119    def __init__(self, config, logger = None): 
     120        _Analyser_Merge_School_Fr.__init__(self, config, logger) 
     121        self.officialName += " - Guadeloupe" 
     122        self.sourceWhere = lambda res: self.is_in_guadeloupe(float(res[1]), float(res[2])) 
     123        self.sourceSRID = "2970" 
     124 
     125class Analyser_Merge_School_Fr_Guyane(_Analyser_Merge_School_Fr): 
     126    def __init__(self, config, logger = None): 
     127        _Analyser_Merge_School_Fr.__init__(self, config, logger) 
     128        self.officialName += " - Guyane" 
     129        self.sourceWhere = lambda res: self.is_in_guyane(float(res[1]), float(res[2])) 
     130        self.sourceSRID = "2972" 
     131 
     132class Analyser_Merge_School_Fr_Reunion(_Analyser_Merge_School_Fr): 
     133    def __init__(self, config, logger = None): 
     134        _Analyser_Merge_School_Fr.__init__(self, config, logger) 
     135        self.officialName += " - Réunion" 
     136        self.sourceWhere = lambda res: self.is_in_reunion(float(res[1]), float(res[2])) 
     137        self.sourceSRID = "2975" 
     138 
     139class Analyser_Merge_School_Fr_Martinique(_Analyser_Merge_School_Fr): 
     140    def __init__(self, config, logger = None): 
     141        _Analyser_Merge_School_Fr.__init__(self, config, logger) 
     142        self.officialName += " - Martinique" 
     143        self.sourceWhere = lambda res: self.is_in_martinique(float(res[1]), float(res[2])) 
     144        self.sourceSRID = "2973" 
Note: See TracChangeset for help on using the changeset viewer.