本文整理汇总了Python中mapproxy.config.validator.validate_references函数的典型用法代码示例。如果您正苦于以下问题:Python validate_references函数的具体用法?Python validate_references怎么用?Python validate_references使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validate_references函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_misconfigured_mapserver_source_without_globals
def test_misconfigured_mapserver_source_without_globals(self):
conf = self._test_conf('''
sources:
one_source:
type: mapserver
req:
map: foo.map
mapserver:
binary: /foo/bar/baz
''')
errors = validate_references(conf)
eq_(errors, [
'Could not find mapserver binary (/foo/bar/baz)'
])
del conf['sources']['one_source']['mapserver']['binary']
errors = validate_references(conf)
eq_(errors, [
"Missing mapserver binary for source 'one_source'"
])
del conf['sources']['one_source']['mapserver']
errors = validate_references(conf)
eq_(errors, [
"Missing mapserver binary for source 'one_source'"
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:29,代码来源:test_conf_validator.py
示例2: test_band_merge_missing_source
def test_band_merge_missing_source(self):
conf = self._test_conf('''
caches:
one_cache:
sources:
l:
- source: dop
band: 1
factor: 0.4
- source: missing1
band: 2
factor: 0.2
- source: cache_missing_source
band: 2
factor: 0.2
grids: [GLOBAL_MERCATOR]
cache_missing_source:
sources: [missing2]
grids: [GLOBAL_MERCATOR]
sources:
dop:
type: wms
req:
url: http://localhost/service?
layers: dop
''')
errors = validate_references(conf)
eq_(errors, [
"Source 'missing1' for cache 'one_cache' not found in config",
"Source 'missing2' for cache 'cache_missing_source' not found in config",
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:33,代码来源:test_conf_validator.py
示例3: test_missing_services_section
def test_missing_services_section(self):
conf = self._test_conf()
del conf['services']
errors = validate_references(conf)
eq_(errors, [
'Missing services section'
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:7,代码来源:test_conf_validator.py
示例4: test_missing_cache_source
def test_missing_cache_source(self):
conf = self._test_conf()
del conf['sources']['one_source']
errors = validate_references(conf)
eq_(errors, [
"Source 'one_source' for cache 'one_cache' not found in config"
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:8,代码来源:test_conf_validator.py
示例5: test_missing_layers_section
def test_missing_layers_section(self):
conf = self._test_conf()
del conf['layers']
errors = validate_references(conf)
eq_(errors, [
'Missing layers section'
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:8,代码来源:test_conf_validator.py
示例6: test_missing_layer_source
def test_missing_layer_source(self):
conf = self._test_conf()
del conf['caches']['one_cache']
errors = validate_references(conf)
eq_(errors, [
"Source 'one_cache' for layer 'one' not in cache or source section"
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:8,代码来源:test_conf_validator.py
示例7: test_misconfigured_wms_source
def test_misconfigured_wms_source(self):
conf = self._test_conf()
del conf['sources']['one_source']['req']['layers']
errors = validate_references(conf)
eq_(errors, [
"Missing 'layers' for source 'one_source'"
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:9,代码来源:test_conf_validator.py
示例8: test_without_cache
def test_without_cache(self):
conf = self._test_conf('''
layers:
- name: one
title: One
sources: [one_source]
''')
errors = validate_references(conf)
eq_(errors, [])
开发者ID:Geodan,项目名称:mapproxy,代码行数:10,代码来源:test_conf_validator.py
示例9: test_tile_source
def test_tile_source(self):
conf = self._test_conf('''
layers:
- name: one
tile_sources: [missing]
''')
errors = validate_references(conf)
eq_(errors, [
"Tile source 'missing' for layer 'one' not in cache section"
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:11,代码来源:test_conf_validator.py
示例10: test_empty_layer_sources
def test_empty_layer_sources(self):
conf = self._test_conf('''
layers:
- name: one
title: One
sources: []
''')
errors = validate_references(conf)
eq_(errors, [
"Missing sources for layer 'one'"
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:12,代码来源:test_conf_validator.py
示例11: test_cascaded_caches
def test_cascaded_caches(self):
conf = self._test_conf('''
caches:
one_cache:
sources: [two_cache]
two_cache:
grids: [GLOBAL_MERCATOR]
sources: ['one_source']
''')
errors = validate_references(conf)
eq_(errors, [])
开发者ID:Geodan,项目名称:mapproxy,代码行数:12,代码来源:test_conf_validator.py
示例12: test_tagged_source_without_layers
def test_tagged_source_without_layers(self):
conf = self._test_conf('''
caches:
one_cache:
grids: [GLOBAL_MERCATOR]
sources: ['one_source:foo,bar']
''')
del conf['sources']['one_source']['req']['layers']
errors = validate_references(conf)
eq_(errors, [])
开发者ID:Geodan,项目名称:mapproxy,代码行数:12,代码来源:test_conf_validator.py
示例13: test_with_grouped_layer
def test_with_grouped_layer(self):
conf = self._test_conf('''
layers:
- name: group
title: Group
layers:
- name: one
title: One
sources: [one_cache]
''')
errors = validate_references(conf)
eq_(errors, [])
开发者ID:Geodan,项目名称:mapproxy,代码行数:13,代码来源:test_conf_validator.py
示例14: test_tagged_sources_with_layers
def test_tagged_sources_with_layers(self):
conf = self._test_conf('''
caches:
one_cache:
grids: [GLOBAL_MERCATOR]
sources: ['one_source:foo,bar']
''')
errors = validate_references(conf)
eq_(errors, [
"Supported layers for source 'one_source' are 'one' but tagged source "
"requested layers 'foo, bar'"
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:13,代码来源:test_conf_validator.py
示例15: test_missing_grid
def test_missing_grid(self):
conf = self._test_conf('''
caches:
one_cache:
grids: [MYGRID_OTHERGRID]
grids:
MYGRID:
base: GLOBAL_GEODETIC
''')
errors = validate_references(conf)
eq_(errors, [
"Grid 'MYGRID_OTHERGRID' for cache 'one_cache' not found in config"
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:14,代码来源:test_conf_validator.py
示例16: test_tagged_layers_for_unsupported_source_type
def test_tagged_layers_for_unsupported_source_type(self):
conf = self._test_conf('''
sources:
one_source:
type: tile
url: http://localhost/tiles/
caches:
one_cache:
grids: [GLOBAL_MERCATOR]
sources: ['one_source:foo,bar']
''')
errors = validate_references(conf)
eq_(errors, [
"Found tagged source 'one_source' in cache 'one_cache' but tagged sources "
"only supported for 'wms, mapserver, mapnik' sources"
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:17,代码来源:test_conf_validator.py
示例17: test_mapserver_with_tagged_layers
def test_mapserver_with_tagged_layers(self):
conf = self._test_conf('''
sources:
one_source:
type: mapserver
req:
map: foo.map
layers: one
mapserver:
binary: /foo/bar/baz
caches:
one_cache:
grids: [GLOBAL_MERCATOR]
sources: ['one_source:foo,bar']
''')
errors = validate_references(conf)
eq_(errors, [
'Could not find mapserver binary (/foo/bar/baz)',
"Supported layers for source 'one_source' are 'one' but tagged source "
"requested layers 'foo, bar'"
])
开发者ID:Geodan,项目名称:mapproxy,代码行数:22,代码来源:test_conf_validator.py
示例18: test_with_int_0_as_names_and_layers
def test_with_int_0_as_names_and_layers(self):
conf = self._test_conf('''
services:
wms:
md:
title: MapProxy
layers:
- name: 0
title: One
sources: [0]
caches:
0:
grids: [GLOBAL_MERCATOR]
sources: [0]
sources:
0:
type: wms
req:
url: http://localhost/service?
layers: 0
''')
errors = validate_references(conf)
eq_(errors, [])
开发者ID:Geodan,项目名称:mapproxy,代码行数:24,代码来源:test_conf_validator.py
示例19: get_mapproxy
#.........这里部分代码省略.........
url = str(layer.url.replace("maps//wms", "maps/wms"))
default_source = {
"type": "wms",
"coverage": {
"bbox": bbox,
"srs": srs,
"bbox_srs": bbox_srs,
"supported_srs": ["EPSG:4326", "EPSG:900913", "EPSG:3857"],
},
"req": {"layers": layer_name, "url": url, "transparent": True},
}
if layer.service.type == "ESRI_MapServer":
default_source = {
"type": "tile",
"url": str(layer.service.url).split("?")[0] + "tile/%(z)s/%(y)s/%(x)s",
"grid": "default_grid",
"transparent": True,
}
# A source is the WMS config
sources = {"default_source": default_source}
# A grid is where it will be projects (Mercator in our case)
grids = {"default_grid": {"tile_size": [256, 256], "srs": grid_srs, "origin": "nw"}}
# A cache that does not store for now. It needs a grid and a source.
caches = {
"default_cache": {
"cache": {
"type": "file",
"directory_layout": "tms",
"directory": os.path.join(
tempfile.gettempdir(),
"mapproxy",
"layer",
"%s" % layer.id,
"map",
"wmts",
layer_name,
"default_grid",
),
},
"grids": ["default_grid"],
"sources": ["default_source"],
}
}
# The layer is connected to the cache
layers = [{"name": layer_name, "sources": ["default_cache"], "title": str(layer.title)}]
# Services expose all layers.
# WMS is used for reprojecting
# TMS is used for easy tiles
# Demo is used to test our installation, may be disabled in final version
services = {
"wms": {
"image_formats": ["image/png"],
"md": {"abstract": "This is the Harvard HyperMap Proxy.", "title": "Harvard HyperMap Proxy"},
"srs": ["EPSG:4326", "EPSG:3857"],
"versions": ["1.1.1"],
},
"wmts": {"restful": True, "restful_template": "/{Layer}/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png"},
"tms": {"origin": "nw"},
"demo": None,
}
# Start with a sane configuration using MapProxy's defaults
conf_options = load_default_config()
# Populate a dictionary with custom config changes
extra_config = {"caches": caches, "grids": grids, "layers": layers, "services": services, "sources": sources}
yaml_config = yaml.dump(extra_config, default_flow_style=False)
# If you want to test the resulting configuration. Turn on the next
# line and use that to generate a yaml config.
# assert False
# Merge both
load_config(conf_options, config_dict=extra_config)
# Make sure the config is valid.
errors, informal_only = validate_options(conf_options)
for error in errors:
log.warn(error)
if not informal_only or (errors and not ignore_warnings):
raise ConfigurationError("invalid configuration")
errors = validate_references(conf_options)
for error in errors:
log.warn(error)
conf = ProxyConfiguration(conf_options, seed=seed, renderd=renderd)
# Create a MapProxy App
app = MapProxyApp(conf.configured_services(), conf.base_config)
# Wrap it in an object that allows to get requests by path as a string.
return TestApp(app), yaml_config
开发者ID:jmwenda,项目名称:hypermap,代码行数:101,代码来源:views.py
示例20: get_mapproxy
#.........这里部分代码省略.........
'default_grid': {
'tile_size': [256, 256],
'srs': grid_srs,
'origin': 'nw',
}
}
# A cache that does not store for now. It needs a grid and a source.
caches = {'default_cache':
{
'cache':
{
'type': 'file',
'directory_layout': 'tms',
'directory': os.path.join(tempfile.gettempdir(),
'mapproxy',
'layer',
'%s' % layer.id,
'map',
'wmts',
layer_name,
'default_grid',
),
},
'grids': ['default_grid'],
'sources': ['default_source']},
}
# The layer is connected to the cache
layers = [
{'name': layer_name,
'sources': ['default_cache'],
'title': str(layer.title),
},
]
# Services expose all layers.
# WMS is used for reprojecting
# TMS is used for easy tiles
# Demo is used to test our installation, may be disabled in final version
services = {
'wms': {'image_formats': ['image/png'],
'md': {'abstract': 'This is the Harvard HyperMap Proxy.',
'title': 'Harvard HyperMap Proxy'},
'srs': ['EPSG:4326', 'EPSG:3857'],
'versions': ['1.1.1']},
'wmts': {
'restful': True,
'restful_template':
'/{Layer}/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png',
},
'tms': {
'origin': 'nw',
},
'demo': None,
}
global_config = {
'http': {'ssl_no_cert_checks': True},
}
# Start with a sane configuration using MapProxy's defaults
conf_options = load_default_config()
# Populate a dictionary with custom config changes
extra_config = {
'caches': caches,
'grids': grids,
'layers': layers,
'services': services,
'sources': sources,
'globals': global_config,
}
yaml_config = yaml.dump(extra_config, default_flow_style=False)
# If you want to test the resulting configuration. Turn on the next
# line and use that to generate a yaml config.
# assert False
# Merge both
load_config(conf_options, config_dict=extra_config)
# Make sure the config is valid.
errors, informal_only = validate_options(conf_options)
for error in errors:
log.warn(error)
if not informal_only or (errors and not ignore_warnings):
raise ConfigurationError('invalid configuration')
errors = validate_references(conf_options)
for error in errors:
log.warn(error)
conf = ProxyConfiguration(conf_options, seed=seed, renderd=renderd)
# Create a MapProxy App
app = MapProxyApp(conf.configured_services(), conf.base_config)
# Wrap it in an object that allows to get requests by path as a string.
return TestApp(app), yaml_config
开发者ID:panchicore,项目名称:HHypermap,代码行数:101,代码来源:views.py
注:本文中的mapproxy.config.validator.validate_references函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论