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]
评论列表
文章目录