本文整理汇总了Python中mapproxy.template.bunch函数的典型用法代码示例。如果您正苦于以下问题:Python bunch函数的具体用法?Python bunch怎么用?Python bunch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bunch函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: template_context
def template_context(self):
return dict(
service=bunch(default="", **self.service),
restful=False,
layers=self.layers,
tile_matrix_sets=self.matrix_sets,
)
示例2: template_context
def template_context(self):
return dict(service=bunch(default='', **self.service),
restful=True,
layers=self.layers,
tile_matrix_sets=self.matrix_sets,
resource_template=self.template,
format_resource_template=format_resource_template,
)
示例3: _tile_matrices
def _tile_matrices(self):
for level, res in self.grid.resolutions.iteritems():
origin = self.grid.origin_tile(level, "ul")
bbox = self.grid.tile_bbox(origin)
grid_size = self.grid.grid_sizes[level]
scale_denom = res / (0.28 / 1000) * meter_per_unit(self.grid.srs)
yield bunch(
identifier=level, bbox=bbox, grid_size=grid_size, scale_denom=scale_denom, tile_size=self.grid.tile_size
)
示例4: template_context
def template_context(self):
return dict(service=bunch(default='', **self.service),
restful=True,
layers=self.layers,
tile_matrix_sets=self.matrix_sets,
resource_template=self.url_converter.template,
# dimension_key maps lowercase dimensions to the actual
# casing from the restful template
dimension_keys=dict((k.lower(), k) for k in self.url_converter.dimensions),
format_resource_template=format_resource_template,
)
示例5: _render_template
def _render_template(self, template):
template = get_template(template)
doc = template.substitute(service=bunch(default='', **self.service),
layers=self.layers,
formats=self.image_formats,
info_formats=self.info_formats,
srs=self.srs,
tile_layers=self.tile_layers,
layer_srs_bbox=self.layer_srs_bbox,
)
# strip blank lines
doc = '\n'.join(l for l in doc.split('\n') if l.rstrip())
return doc
示例6: _tile_matrices
def _tile_matrices(self):
for level, res in self.grid.resolutions.iteritems():
origin = self.grid.origin_tile(level, 'ul')
bbox = self.grid.tile_bbox(origin)
topleft = bbox[0], bbox[3]
if self.grid.srs.is_axis_order_ne:
topleft = bbox[3], bbox[0]
grid_size = self.grid.grid_sizes[level]
scale_denom = res / (0.28 / 1000) * meter_per_unit(self.grid.srs)
yield bunch(
identifier=level,
topleft=topleft,
grid_size=grid_size,
scale_denom=scale_denom,
tile_size=self.grid.tile_size,
)
示例7: _render_layer_template
def _render_layer_template(self, layer, service):
template = get_template(self.layer_template_file)
return template.substitute(service=bunch(default='', **service), layer=layer)
示例8: _render_root_resource_template
def _render_root_resource_template(self, service):
template = get_template(self.root_resource_template_file)
return template.substitute(service=bunch(default='', **service))