query.py 文件源码

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

项目:api 作者: opentraffic 项目源码 文件源码
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!
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号