def load_into_index(self, t, level, tile_dir):
if tile_hierarchy.levels.has_key(level):
file_name = tile_hierarchy.levels[level].GetFilename(t, level, os.environ['TILE_DIR'])
if (file_name is not None and os.path.isfile(file_name)):
# if the file has not be cached, we must load it up into the index.
if t not in cached_tiles:
with open(file_name) as f:
geojson = json.load(f)
for feature in geojson['features']:
geom = shape(feature['geometry'])
osmlr_id = long(feature['properties']['osmlr_id'])
index.insert(osmlr_id, geom.bounds)
# this is our set of tiles that have been loaded into the index, only load each tile once.
cached_tiles.add(t)
#parse the request because we dont get this for free!
评论列表
文章目录