geostatil.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:geostatil 作者: akariv 项目源码 文件源码
def __init__(self):
        self.path = os.path.join(os.path.dirname(__file__),'data')
        self.stat_data = {}
        self.header_conversion = {}
        self.stat_data, self.header_conversion = \
            json.load(open(os.path.join(self.path,'stat-data.json')))
        geometries = json.load(open(os.path.join(self.path,'geometries.json')))
        crs = json.load(open(os.path.join(self.path,'crs.json')))
        self.proj = pyproj.Proj(crs)
        self.recs = [{
            'shp':shapely.geometry.asShape(geometry),
            'area': area_id,
        } for area_id, geometry in geometries.items()]

        for r in self.recs:
            bounds = r['shp'].bounds
            r['key'] = bounds[2] + bounds[3]
            r['bounds'] = bounds
        self.recs.sort(key=lambda r:r['key'])
        self.rec_keys = [r['key'] for r in self.recs]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号