当前位置: 首页>>代码示例>>Python>>正文


Python BoundingPyramid.from_wgs84方法代码示例

本文整理汇总了Python中tilecloud.BoundingPyramid.from_wgs84方法的典型用法代码示例。如果您正苦于以下问题:Python BoundingPyramid.from_wgs84方法的具体用法?Python BoundingPyramid.from_wgs84怎么用?Python BoundingPyramid.from_wgs84使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tilecloud.BoundingPyramid的用法示例。


在下文中一共展示了BoundingPyramid.from_wgs84方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import from_wgs84 [as 别名]
 def __init__(self, tile_json, urls_key='tiles', **kwargs):
     # FIXME schema
     # FIXME version 1.0.0 support
     d = json.loads(tile_json)
     assert 'tiles' in d
     assert isinstance(d['tiles'], list)
     assert len(d['tiles']) > 0
     for key in self.KEYS:
         kwargs.setdefault(key, d.get(key, None))
     if 'bounding_pyramid' not in kwargs:
         zmin, zmax = d.get('minzoom', 0), d.get('maxzoom', 22)
         if 'bounds' in d:
             lonmin, latmin, lonmax, latmax = d['bounds']
             bounding_pyramid = BoundingPyramid.from_wgs84(zmin, zmax,
                                                           lonmin, lonmax,
                                                           latmin, latmax)
         else:
             bounding_pyramid = BoundingPyramid.full(zmin, zmax)
         kwargs['bounding_pyramid'] = bounding_pyramid
     urls = d[urls_key]
     if 'content_type' not in kwargs:
         exts = set(os.path.splitext(urlparse(url).path)[1] for url in urls)
         content_types = set(mimetypes.types_map.get(ext) for ext in exts)
         assert len(content_types) == 1
         kwargs['content_type'] = content_types.pop()
     templates = [re.sub(r'\{([xyz])\}', lambda m: '%%(%s)d' % m.group(1), url)
                  for url in urls]
     tile_layouts = map(TemplateTileLayout, templates)
     URLTileStore.__init__(self, tile_layouts, **kwargs)
开发者ID:fredj,项目名称:tilecloud,代码行数:31,代码来源:tilejson.py


注:本文中的tilecloud.BoundingPyramid.from_wgs84方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。